/* ===== GLOBAL STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* aligning css with edwardyu.net color theme */
:root {
  --primary-dark: rgba(25, 9, 63, 1);
  --primary-medium: rgba(25, 9, 63, 1);
  --primary-light: rgba(25, 9, 63, 0.2);
  --accent-blue: rgba(25, 9, 63, 1);
  --accent-light: rgba(25, 9, 63, 0.2);
  --bg-primary: rgba(247, 248, 245, 1);
  --bg-secondary: rgba(247, 248, 245, 1);
  --bg-dark: rgba(25, 9, 63, 1);
  --text-primary: rgba(25, 9, 63, 1);
  --text-secondary: rgba(25, 9, 63, 1);
  --text-light: rgba(25, 9, 63, 0.2);
  --border-light: rgba(25, 9, 63, 1);
  --shadow-light: rgba(0, 0, 0, 0.05);
  --shadow-medium: rgba(0, 0, 0, 0.1);
  --success-muted: rgba(25, 9, 63, 1);
  --danger-muted: rgba(25, 9, 63, 1);

  --font-main: "Open Sans", Helvetica, sans-serif;
  --font-mono: "Open Sans", Helvetica, sans-serif;
}

body {
  font-family: var(--font-main);
  background: linear-gradient(135deg, var(--bg-primary) 0%, #e8eaf6 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent text selection on UI elements */
.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* ===== HOME PAGE STYLES ===== */
.mindless {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(80px, 15vw, 150px);
  background: linear-gradient(135deg, var(--primary-dark), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 200;
  letter-spacing: -0.02em;
  animation: fadeIn 1.5s ease-out;
  user-select: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home_form {
  position: fixed;
  bottom: 15vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 0 20px;
  animation: slideUp 0.8s ease-out 0.5s both;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.input_name,
.join_div {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  max-width: 500px;
}

.home_form label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 60px;
}

.home_form input[type="text"] {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.home_form input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(96, 125, 139, 0.1);
}

.home_form button {
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.join_btn {
  background: var(--accent-blue);
  color: white;
  min-width: 140px;
}

.join_btn:hover {
  background: var(--primary-medium);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-medium);
}

.create_btn {
  background: var(--primary-dark);
  color: white;
  width: 100%;
  max-width: 400px;
  margin-top: 10px;
}

.create_btn:hover {
  background: var(--bg-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-medium);
}

.err_msg {
  position: fixed;
  bottom: 8vh;
  left: 50%;
  transform: translateX(-50%);
  color: var(--danger-muted);
  font-size: 14px;
  font-weight: 500;
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(-50%);
  }
  25% {
    transform: translateX(-52%);
  }
  75% {
    transform: translateX(-48%);
  }
}

/* ===== ROOM PAGE STYLES ===== */

/* Top Bar - Combined info box */
.top-left-corner {
  padding: 12px 20px;
  position: fixed;
  left: 20px;
  top: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: 0 2px 10px var(--shadow-light);
  z-index: 100;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 250px;
}

.top-left-corner #round {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.top-left-corner #deck {
  font-size: 16px;
  color: var(--text-secondary);
}

.top-right-corner {
  padding: 12px 20px;
  position: fixed;
  right: 20px;
  top: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  box-shadow: 0 2px 10px var(--shadow-light);
  z-index: 100;
  font-size: 28px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--primary-dark);
  letter-spacing: 0.1em;
  user-select: text; /* Allow selection for room code */
  cursor: text;
}

/* Main Content Area */
.main-content {
  position: fixed;
  left: 0;
  width: 70%;
  height: 100vh;
  padding: 100px 20px 20px;
}

/* Game Table */
.gametable {
  height: calc(100vh - 300px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 20px;
}

.cardlist {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

/* Last Played Card Display */
.last-played-container {
  display: none; /* Hidden until game starts */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(
    135deg,
    rgba(25, 9, 63, 0.05),
    rgba(25, 9, 63, 0.1)
  );
  border-radius: 20px;
  border: 2px solid var(--accent-light);
  min-height: 120px;
  animation: fadeIn 0.5s ease-out;
}

.last-played-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.last-played-card {
  font-size: 64px;
  font-weight: 700;
  color: var(--primary-dark);
  line-height: 1;
  transition: all 0.3s ease;
}

.last-played-card.updated {
  animation: cardUpdate 0.6s ease-out;
}

@keyframes cardUpdate {
  0% {
    transform: scale(1.5);
    color: var(--accent-blue);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    color: var(--primary-dark);
  }
}

.last-played-player {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
  font-style: italic;
}

.gameboard-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  margin-bottom: 10px;
  user-select: none;
}

.cardlist > div:not(.gameboard-title) {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  max-width: 100%;
}

.numbercircle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
  border: 3px solid var(--accent-light);
  border-radius: 16px;
  font-size: 32px;
  font-weight: 600;
  color: var(--primary-dark);
  box-shadow: 0 4px 12px var(--shadow-light);
  transition: all 0.3s ease;
  cursor: pointer;
  user-select: none;
  animation: cardAppear 0.5s ease-out;
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.numbercircle:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 8px 20px var(--shadow-medium);
  border-color: var(--accent-blue);
}

.numbercircle.playing {
  animation: cardPlay 0.6s ease-out forwards;
}

@keyframes cardPlay {
  to {
    opacity: 0;
    transform: translateY(-100px) scale(0.5) rotate(180deg);
  }
}

.others {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  backdrop-filter: blur(10px);
}

.others-table {
  width: 100%;
  max-width: 600px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px var(--shadow-light);
}

.others-table td {
  padding: 12px;
  text-align: center;
  font-size: 18px;
  border: none;
  border-bottom: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
}

.others-table tr:first-child td {
  background: var(--bg-primary);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.others-table td:last-child {
  border-right: none;
}

.others-table tr:last-child td {
  border-bottom: none;
}

/* Big Button Area */
.big-button {
  position: fixed;
  bottom: 20px;
  left: 0;
  width: 70%;
  height: 120px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.readybtn,
.playbtn {
  width: 75%;
  height: 100%;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  box-shadow: 0 4px 20px var(--shadow-light);
}

.playbtn {
  display: none; /* Hidden by default */
}

.readybtn {
  background: linear-gradient(
    135deg,
    var(--danger-muted),
    var(--primary-medium)
  );
  color: white;
}

.readybtn[value="Yes"] {
  background: linear-gradient(135deg, var(--success-muted), var(--accent-blue));
}

.readybtn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px var(--shadow-medium);
}

.playbtn {
  background: linear-gradient(135deg, var(--accent-blue), var(--primary-dark));
  color: white;
  display: none; /* Hidden by default */
}

.playbtn:hover:not([style*="pointer-events: none"]) {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px var(--shadow-medium);
}

/* Sidebar */
.sidebar {
  position: fixed;
  right: 0;
  top: 0;
  width: 30%;
  height: 100vh;
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
}

.plays {
  flex: 1;
  padding: 80px 20px 20px;
  overflow-y: auto;
  border-bottom: 1px solid var(--border-light);
}

.plays .text {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  animation: messageSlide 0.3s ease-out;
}

.plays .text strong {
  color: var(--text-primary);
  font-weight: 600;
}

.messageinput {
  padding: 15px;
  display: flex;
  gap: 10px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-light);
}

#message-input {
  flex: 1;
  padding: 10px 15px;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 14px;
  background: var(--bg-secondary);
  transition: all 0.3s ease;
}

#message-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

#send-btn {
  padding: 10px 20px;
  background: var(--accent-blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all 0.3s ease;
}

#send-btn:hover {
  background: var(--primary-medium);
  transform: translateY(-2px);
}

.messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.messages .text {
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Countdown Overlay */
.countdown {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1000;
}

.countdowntext {
  font-size: clamp(120px, 20vw, 300px);
  font-weight: 200;
  color: var(--primary-dark);
  opacity: 0.8;
  user-select: none;
  animation: pulse 1s ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(0.5);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.8;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-blue);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .main-content {
    width: 60%;
  }

  .sidebar {
    width: 40%;
  }

  .numbercircle {
    width: 70px;
    height: 70px;
    font-size: 28px;
  }

  .top-left-corner {
    min-width: 200px;
  }

  .last-played-card {
    font-size: 48px;
  }
}

@media (max-width: 768px) {
  .main-content {
    width: 100%;
    padding-bottom: 200px;
  }

  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    border-left: none;
    border-top: 1px solid var(--border-light);
    flex-direction: row;
  }

  .plays {
    width: 40%;
    padding-top: 20px;
    border-bottom: none;
    border-right: 1px solid var(--border-light);
  }

  .messageinput {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60%;
    z-index: 10;
  }

  .messages {
    width: 60%;
    padding-bottom: 70px;
  }

  .big-button {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .readybtn,
  .playbtn {
    width: 75%;
  }

  .top-left-corner,
  .top-right-corner {
    padding: 8px 12px;
    top: 10px;
  }

  .top-left-corner {
    left: 10px;
    min-width: 180px;
  }

  .top-left-corner #round {
    font-size: 16px;
  }

  .top-left-corner #deck {
    font-size: 14px;
  }

  .top-right-corner {
    right: 10px;
    font-size: 20px;
  }

  .last-played-card {
    font-size: 36px;
  }

  .last-played-container {
    min-height: 80px;
    padding: 15px;
  }
}

@media (max-width: 480px) {
  .numbercircle {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }

  .big-button {
    height: 80px;
  }

  .readybtn,
  .playbtn {
    font-size: 24px;
  }

  .others-table td {
    font-size: 14px;
    padding: 8px;
  }

  .top-left-corner {
    min-width: 160px;
  }

  .last-played-card {
    font-size: 32px;
  }

  .last-played-label {
    font-size: 11px;
  }

  .last-played-player {
    font-size: 12px;
  }
}

/*************************************************************
    Section: Navigation menu
*************************************************************/
.navbar {
  width: 150px;
  height: 160px;
  position: fixed;
  top: 40px;
  right: 10px;
  display: box;
  justify-content: center;
  align-items: center;
  font-size: 17px;
}

.nav-list {
  text-align: left;
  background-color: var(--primary-light);
  opacity: 0.9;
  visibility: hidden;
  padding: 20px;
}

.change .nav-list {
  top: 30px;
  position: absolute;
  visibility: visible;
  opacity: 0.8;
  transition: visibility 0.1s linear, opacity 0.8s linear;
}

.nav-item {
  color: var(--fgcolor);
  list-style: none;
  margin: 0px;
  text-transform: capitalize;
  letter-spacing: 1.5px;
  margin-top: 10px;
  font-weight: normal;
}

.nav-item:hover {
  font-weight: bold;
  transition: 0.2s;
}

.change .nav-list {
  top: 50px;
  right: 0px;
}

.nav-item {
  letter-spacing: 1.5px;
}

.line {
  width: 100%;
  height: 1px;
  background-color: black;
  transition: all 0.8s;
}

.change .line-1 {
  transform: rotateZ(-45deg) translate(-8px, 6px);
}

.change .line-2 {
  opacity: 0;
}

.change .line-3 {
  transform: rotateZ(45deg) translate(-8px, -6px);
}

.hamburger-menu {
  top: 10px;
  right: 10px;
  width: 35px;
  height: 30px;
  position: fixed;
  top: 50px;
  right: 50px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}
