/* style.css */
/* (unchanged; both modals use the same .modal-overlay and .modal styles below) */

/* ---------- RESET ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ========== GLOBAL COLOURS ========== */
:root {
  --grid-colour: rgba(15, 214, 204, 0.9);
}
.hidden {
  display: none;
}

/* ---------- GENERAL ---------- */
body {
  height: 90vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  font-family: "Arial", sans-serif;
  background: url("../assets/background.svg") center/cover no-repeat fixed;
  overflow: hidden;
  margin-top: 10%;
}

main {
  flex: 1;
  width: 100%;
  max-width: 500px;
  padding-top: 8vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: visible;
}

/* ---------- HEADER ---------- */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 650px;
  height: 8vh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 50;
}
.header-icon {
  width: 44px;
  height: 44px;
  cursor: pointer;
}
.header-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

/* ---------- BANNER ---------- */
.banner {
  position: relative;
  width: 100%;
  margin-top: 20%;
}
.banner-img {
  width: 100%;
  border-radius: 16px;
}
.play-btn {
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #ff881b;
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 6px 8px rgb(0 0 0 / 60%);
}

/* ---------- LOBBY ---------- */
.lobby {
  width: 100%;
  margin-top: 90px;
}
.lobby-header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.create-room-btn {
  background: #ff881b;
  padding: 10px 16px;
  border-radius: 20px;
  border: none;
  color: #fff;
  font-weight: 700;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 6px 8px rgb(0 0 0 / 60%);
  margin-bottom: 20px;
  width: 70%;
  height: 40px;
  text-wrap: nowrap;
}
.rooms-title {
  color: #fff;
  font-size: 1.2rem;
  letter-spacing: 1px;
}

/* ========================================================= */
/*                     GAME SCREEN STYLES                    */
/* ========================================================= */
#game {
  position: relative;
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.game-status,
#opponent-play-again-status,
#opponent-left-status {
  position: absolute;
  top: calc(8vh + 8px);
  left: 50%;
  transform: translateX(-50%);
  color: #e0e0e0;
  font-size: 0.95rem;
  text-align: center;
}

/* CTA buttons */
.cta-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 85%;
  max-width: 320px;
  height: 42px;
  border: none;
  border-radius: 32px;
  background: #ff881b;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.6);
}
.play-again {
  bottom: 20px;
}
.rejoin {
  bottom: 70px;
  background: #ffae63;
}

/* --- player row --- */
.players-row {
  width: 100%;
  max-width: 430px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  overflow: visible;
}

.player {
  text-align: center;
  flex: 0 0 46%;
}
.player-name {
  padding-top: 50px;
  color: white;
}
.avatar-wrapper {
  position: relative;
  width: 62px;
  height: 62px;
  margin: 0 auto;
  margin-bottom: 12px; /* space between image and name */
  overflow: visible;
}
.player-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #09cfc9;
}

.player.active-turn .avatar-wrapper {
  box-shadow: 0 0 0 6px #ff881b;
  border-radius: 50%;
}

/* thought-pop animation */
@keyframes thoughtPop {
  0% {
    transform: translateX(-50%) scale(0.5);
  }
  70% {
    transform: translateX(-50%) scale(1.2);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}
.thought-bubble {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) scale(0);
  background: #fff;
  color: #012721;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  z-index: 1000;
  display: inline-block;
}
.thought-bubble.animate {
  animation: thoughtPop 0.4s ease-out forwards;
}

/* ---------- BOARD ---------- */
.board-wrapper {
  width: 100%;
  max-width: 430px;
  aspect-ratio: 1 / 1;
  background: #012721;
  border-radius: 6px;
  padding: 14px;
}
.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  grid-template-rows: repeat(10, minmax(0, 1fr));
  border: 2px solid var(--grid-colour);
}
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.7rem;
  font-weight: 700;
  cursor: pointer;
  color: #ff7a24;
  border-right: 1px solid var(--grid-colour);
  border-bottom: 1px solid var(--grid-colour);
  min-width: 0;
  min-height: 0;
}
.cell.player-o {
  color: #15c9c6;
}
.cell:nth-child(10n) {
  border-right: none;
}
.cell:nth-last-child(-n + 10) {
  border-bottom: none;
}
.cell.selected {
  outline: 3px solid #fff;
  outline-offset: -3px;
}
/* style.css */
/* --- controls --- */
.controls-wrapper {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}
.arrows {
  display: flex;
  align-items: flex-end; /* align left/right arrows down */
  gap: 4px;
}
.vertical-arrows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.arrow-btn {
  width: 74px;
  height: 74px;
  border: 3px solid #013832;
  border-radius: 4px;
  background: #00a38f;
  font-size: 2rem;
  font-weight: 700;
  color: #012721;
  cursor: pointer;
}
.set-btn {
  width: 106px;
  height: 106px;
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  background: #ff881b;
  cursor: pointer;
  box-shadow: 0 6px 8px rgb(0 0 0 / 60%);
}

/* Modal styling (applies to both Create and Join) */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
}
.modal {
  width: 90%;
  max-width: 400px;
  background: #012721;
  color: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.4);
}
.modal-title {
  margin-bottom: 16px;
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 1px;
}
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}
.modal-input {
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #012721;
}
.modal-input:disabled {
  opacity: 0.5;
}
.modal-checkbox {
  margin-right: 8px;
}
.checkbox-row {
  flex-direction: row;
  align-items: center;
}
.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}
.modal-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.3s ease;
}
.modal-btn.create {
  background: #ff881b;
  color: #fff;
  border: none;
}
.modal-btn.create:hover {
  background: #e57018;
}
.modal-btn.cancel {
  background: #ff560b;
  color: #fff;
  border: none;
}
.modal-btn.cancel:hover {
  background: #e5954f;
}

/* Responsive adjustments */
@media (max-width: 400px) {
  .modal {
    padding: 16px;
  }
  .modal-title {
    font-size: 1.2rem;
  }
  .modal-btn {
    padding: 8px;
    font-size: 0.9rem;
  }
}
@media (max-width: 420px) {
  .arrow-btn {
    width: 60px;
    height: 60px;
  }
  .set-btn {
    width: 90px;
    height: 90px;
  }
}
/* style.css */
/* ---------- RESET & EXISTING STYLES (unchanged) ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
:root {
  --grid-colour: rgba(15, 214, 204, 0.9);
}
.hidden {
  display: none;
}
body {
  height: 90vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  font-family: "Arial", sans-serif;
  background: url("../assets/background.svg") center/cover no-repeat fixed;
  overflow: hidden;
  margin-top: 10%;
}
/* …  (all earlier styles stay the same) … */

/* ---------- WIN / LOSE TEXT & CROWN ---------- */
@keyframes winText {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  60% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}
.game-status.win {
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  color: #36be00;
  font-size: 1.2rem;
  font-weight: 600;
}
.game-status.win.animate {
  animation: winText 0.8s ease-out forwards;
}

/* NEW: red styling for “You lose!” */
.game-status.lose {
  color: #ff881b;
  font-size: 1.2rem;
  font-weight: 600;
}

/* Crown animation */
@keyframes crownPop {
  0% {
    transform: translateX(-50%) scale(0);
  }
  60% {
    transform: translateX(-50%) scale(1.2);
  }
  100% {
    transform: translateX(-50%) scale(1);
  }
}
.avatar-crown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  width: 44px;
  height: auto;
  transform: translateX(-50%) scale(0);
  pointer-events: none;
  z-index: 10;
}
.avatar-crown.animate {
  animation: crownPop 0.8s ease-out forwards;
}
