/* CSS Document */

body { font-family:sans-serif; text-align:center; background:#eef1f4; }

		
h2 {
  margin-bottom:0;
  font-size:32px;
  letter-spacing:2px;
  color:#2a9d8f;
  text-shadow:0 2px 6px rgba(0,0,0,0.2);
}
#tag { margin-top:0; color:#666; }


#logoLetter {
  display: inline-block;
  transition: transform 0.6s ease;
}

#logoLetter.flipped {
  transform: rotateX(180deg) translateY(4%);
  text-shadow: 0 -2px 6px rgba(0,0,0,0.2);
}

#logo {
  display: inline-block;
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
}

#logo.flipping {
  animation: flipLogo 0.4s ease forwards;
}

@keyframes flipLogo {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

#lastScoreLine {
    width: fit-content;
    min-width: 240px;
    max-width: 100%;
	transform-origin: center;
    margin: 14px auto 0;
    padding: 5px 10px;
    text-align: center;
    font-size: 14px;
    font-weight: 550;
	letter-spacing: 1px;
    background: #A1C8C1;          /* slightly lighter than score boxes */
    border: 1px solid #A1C8C1;    /* subtle edge so it separates from board */
    border-radius: 10px;
    color: #326762;
    display: none;
}

#lastScoreLine.flash {
  animation: scorePulse 0.5s ease;
}

@keyframes scorePulse {
  0%   { transform: scale(1); filter: brightness(1); }
  30%  { transform: scale(1.12); filter: brightness(1.2); }
  60%  { transform: scale(0.98); }
  100% { transform: scale(1); filter: brightness(1); }
}

#modal.show {
  display:flex; /* 👈 only visible when needed */
}

	#modal.show ~ #controls {
  display: none;
}

#modal.show ~ #game #header {
  display: none;
}	

#modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
}

	@media (max-width: 600px) {

  button {
    padding: 14px 18px;
    font-size: 16px;
    border-radius: 12px;
  }

}

.modal-buttons {
  gap: 8px;
}

.modal-buttons button {
  font-size: 14px !important;
  padding: 10px 14px !important;
  margin: 2px !important;
}

.modal-secondary button {
  background: #e6f2ef !important;
  color: #1f4f4a !important;
  font-size: 14px !important;
  padding: 10px 14px !important;
}

.modal-secondary button:hover {
  background: #a8cfc5 !important;
}

#recentGamesModal {
  position: fixed;
  inset: 0;
  display: none;   /* hidden by default */
  background: rgba(0,0,0,0.6);
  align-items: center;
  justify-content: center;
  z-index: 4000;
}

#recentGamesModal.show {
  display: flex;   /* only visible when triggered */
}


	#gameIdInput {
  display: none;
  text-align: center;
}
	
	#controls {
  display: none;
}

#turnIndicatorMobile {
  display: none;

  margin-top: 8px;
  padding: 10px 14px;

  font-size: 18px;
  font-weight: bold;

  border-radius: 10px;

  text-align: center;

  background: #e6f2ef;
  color: #1f4f4a;

  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

#turnIndicatorMobile.your-turn {
  background: #A1C8C1;
  color: white;
}

/* subtle entrance */
#turnIndicatorMobile.show {
  animation: turnMessagePop 0.4s ease;
}

@keyframes turnMessagePop {
  0%   { transform: translateY(6px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

#message.low {
  top: unset !important;
  bottom: 18vh !important;
  transform: translate(-50%, 0) scale(0.9) !important;
}

#message.low.show {
  animation: messageLow 1.6s ease forwards;
}

@keyframes messageLow {
  0%   { transform: translate(-50%, 10px) scale(0.8); opacity: 0; }
  15%  { transform: translate(-50%, 0) scale(1.1); opacity: 1; }
  85%  { transform: translate(-50%, 0) scale(1); opacity: 1; }
  100% { transform: translate(-50%, -10px) scale(0.95); opacity: 0; }
}

#turnIndicatorDesktop {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 246px;
  border-radius: 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.2);
  align-items: center;
  justify-content: center;
}

#turnIndicatorDesktop.your-turn {
  background: #2a9d8f;
  left: -56px;
}

#turnIndicatorDesktop.their-turn {
  background: #e6f2ef;
  right: -56px;
  left: auto;
}

#turnTextDesktop {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
  line-height: 1.4;
}

#turnIndicatorDesktop.your-turn #turnTextDesktop {
  color: white;
}

#turnIndicatorDesktop.their-turn #turnTextDesktop {
  color: #1f4f4a;
}

.turn-gap { height: 8px; }

@media (max-width: 600px) {
  #turnIndicatorDesktop { display: none !important; }
}


#boardStatus {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  font-size: 16px;
  font-weight: bold;
  color: #2a9d8f;

  background: rgba(230, 242, 239, 0.95);
  padding: 10px 16px;
  border-radius: 10px;

  box-shadow: 0 4px 12px rgba(0,0,0,0.2);

  pointer-events: none;
  z-index: 2000;

  display: none;
}
	
.modal-box {
  background: white;
  border-radius: 14px;
  padding: 24px;

  width: 100%;
  max-width: 420px;

  margin: 0 auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-buttons {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}	
	
.modal-box h3 {
  margin-bottom: 16px;
}

.modal-box input {
  display: block;
  margin: 0 auto 12px auto;
  padding: 12px;
  font-size: 16px;
  box-sizing: border-box;
  text-align: center;
}
	
	.modal-box h3 {
  color: #2a9d8f;
  letter-spacing: 1px;
  font-weight: 700;
}
	
	@media (max-width: 600px) {

  #controls button {
    padding: 10px 12px;   /* 👈 slightly smaller than modal buttons */
    font-size: 14px;
    margin: 4px;
  }

  #mainButtons,
  #stuckButtons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;            /* 👈 tighter gap */
  }

}
	
#mainButtons button:nth-child(2) {
  background: #1f7f73;        /* slightly deeper teal */
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

#mainButtons button:nth-child(2):hover {
  background: #17665c;
}	
@media (max-width: 600px) {

  .modal-box input {
    display: block;
    width: 100%;
    margin: 0 auto 12px auto; /* 👈 centers + spacing */
    padding: 12px;
    font-size: 16px;
    box-sizing: border-box; /* 👈 prevents overflow */
  }

}

	.modal-box input::placeholder {
  color: #aaa;
}
	
	#game {
  position: relative;		
  width: fit-content;
  margin: 0 auto;
}

	@media (max-width: 600px) {
  #game {
    width: 100%;
  }

  #header {
    width: 100%;
    padding: 0 16px;
    box-sizing: border-box;
  }
}
	
#header {
  display:flex;
  justify-content:space-between;
  width: fit-content;
  margin: 10px auto;
  gap: 20px;
}

#p1score, #p2score {
  background:#e6f2ef;   /* very light eau de nil */
  color:#1f4f4a;        /* darker teal text */
  padding:6px 12px;
  border-radius:8px;
  box-shadow:0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.15s ease;
}
	
#p1score.active, #p2score.active {
  background:#2a9d8f;
  color:white;
  transform:scale(1.05);
}

	
#turn {
  margin:10px;
  font-size:20px;
  font-weight:bold;
  color:#2a9d8f;
}

#stuckButtons button {
  background:#a8cfc5;
  color:#1f4f4a;
}

#stuckButtons button:hover {
  background:#95c1b6;
}
	
.board {
  display:grid;
  grid-template-columns:repeat(8,44px);
  gap:4px;
  justify-content:center;
  margin:15px;
}

.cell {
  width:44px; height:44px;
  border:1px solid #bbb;
  background:#e6e9ed;
  border-radius:6px;
  position:relative;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 2px 3px rgba(0,0,0,0.12);
}
	
.purple { background:#2a9d8f; color:white; }

.cell-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.purple .cell-arrow {
  color: white;
  opacity: 0.5;
}

.mult {
  position:absolute;
  bottom:2px;
  right:4px;
  font-size:10px;
  color:white;
}

.score {
  position:absolute;
  bottom:3px;
  right:5px;
  font-size:9px;
  opacity:0.7;
}

.rack { display:flex; justify-content:center; gap:8px; margin-bottom:12px; }

.tile {
  width:44px; height:44px;
  border:1px solid #444;
  background:#ffffff;
  border-radius:8px;
  display:flex; align-items:center; justify-content:center;
  position:relative;
  cursor:pointer;
  font-weight:bold;
  font-size:18px;
  box-shadow:0 2px 3px rgba(0,0,0,0.15);
}

button {
  padding:10px 16px;
  margin:5px;
  border:none;
  border-radius:10px;
  background:#2a9d8f;
  color:white;
  font-weight:bold;
  cursor:pointer;
  transition: transform 0.08s ease, background 0.15s ease;
	
  touch-action: manipulation;	
}

button:hover { background:#23867a; }
button:active { transform:scale(0.96); }

@keyframes pop {
  0% { transform:translateY(6px) scale(0.9); opacity:0; }
  70% { transform:translateY(-2px) scale(1.05); }
  100% { transform:translateY(0) scale(1); opacity:1; }
}

.cell.new {
  animation: pop 0.18s ease;
}	

#rearrangeBtn.rearranging {
  background: #a8cfc5;   /* same as Swap Last Letter */
  color: #1f4f4a;        /* match text colour from stuck buttons */
}

	
#picker {
  position:fixed;
  bottom:20px; left:50%;
  transform:translateX(-50%);
  background:white;
  border:2px solid #ccc;
  padding:10px;
  display:grid;
  grid-template-columns:repeat(6,40px);
  gap:6px;
  visibility:hidden;
  z-index:1000;
}
.winner-text {
  font-size: clamp(32px, 6vw, 80px);
  font-weight: 900;
  color: #ffffff;

  text-align: center;
  line-height: 1.1;

  max-width: 90vw;
  overflow-wrap: anywhere;
  word-break: normal;

  padding: 0 10px;

  text-shadow:
    0 6px 20px rgba(0,0,0,0.7),
    0 0 20px rgba(42,157,143,0.6);

  transform: scale(0.6);
  opacity: 0;

  animation: winnerReveal 0.8s ease forwards;
}
	
@keyframes winnerReveal {
  0%   { transform: scale(0.5); opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
	

.picker-letter {
  width:40px; height:40px;
  border:1px solid #bbb;
  display:flex; align-items:center; justify-content:center;
  cursor:pointer;
  background:#f5f5f5;
}

.cancel-btn {
  grid-column: span 6;   /* 👈 full width of picker */
  height: 40px;
  background: #a8cfc5;
  color: #1f4f4a;
  font-weight: bold;
  border-radius: 8px;
}
	
	.turn-score {
  position:fixed;
  left:50%;
  top:40%;
  transform:translate(-50%, -50%) scale(0.8);

  font-size: clamp(42px, 12vw, 80px); /* 👈 responsive size */
  font-weight:900;

  color:#ffffff;
  text-shadow: 
    0 4px 12px rgba(0,0,0,0.6),
    0 0 16px rgba(42,157,143,0.5);

  pointer-events:none;
  opacity:0;
  z-index:3000;

  animation: scorePop 0.9s ease forwards;
}
	
	.turn-score.big {
  transform:translate(-50%, -50%) scale(1);
}

.turn-score.huge {
  color:#ffffff;
  text-shadow: 0 4px 14px rgba(0,0,0,0.7);
  animation: scorePopHuge 1.1s ease forwards;
}
	
@keyframes scorePop {
  0%   { transform:translate(-50%, -30%) scale(0.6); opacity:0; }
  25%  { transform:translate(-50%, -50%) scale(1.4); opacity:1; }
  60%  { transform:translate(-50%, -55%) scale(1.05); opacity:1; }
  100% { transform:translate(-50%, -70%) scale(0.95); opacity:0; }
}
	
	.turn-score.huge {
  animation: scorePopHuge 1.1s ease forwards;
}


	@keyframes scorePopHuge {
  0%   { transform:translate(-50%, -30%) scale(0.5); opacity:0; }
  20%  { transform:translate(-50%, -50%) scale(1.6); opacity:1; }

  /* 👇 impact shake */
  25%  { transform:translate(-48%, -50%) scale(1.6); }
  30%  { transform:translate(-52%, -50%) scale(1.6); }
  35%  { transform:translate(-49%, -50%) scale(1.5); }
  40%  { transform:translate(-51%, -50%) scale(1.5); }

  60%  { transform:translate(-50%, -55%) scale(1.1); opacity:1; }
  100% { transform:translate(-50%, -75%) scale(1); opacity:0; }
}
	
	@media (max-width: 600px) {

  .board {
    grid-template-columns: repeat(8, 38px);
    gap: 3px;
  }

  .cell, .tile {
    width: 38px;
    height: 38px;
  }

  .rack {
    gap: 6px;
  }
}
	
#stuckMenu {
  position:fixed;
  bottom:20px;
  left:50%;
  transform:translateX(-50%);
  background:white;
  border:2px solid #ccc;
  padding:10px;
  display:flex;
  flex-direction:column;
  gap:8px;
  visibility:hidden;
  z-index:1500;
}
	
	
	#rulesModal .modal-box {
  transform: scale(0.9);
  opacity: 0;
  animation: modalPop 0.25s ease forwards;
}

@keyframes modalPop {
  0%   { transform: scale(0.85); opacity: 0; }
  60%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
	
	#rulesModal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2500;
  padding: 20px;
}

#rulesModal.show {
  display: flex;
}

.rules-title {
  text-align: center;
  color: #2a9d8f;
  font-size: 22px;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.rules-text {
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

.rules-text p {
  margin: 6px 0;
}

.tile.switched {
  background: #deeaeb;
  border: 1px solid #1f4f4a;
}

#menuWrapper {
  display: none;
  position: fixed !important;
  top: 10px;
  right: 10px;
  z-index: 9999;
}

#menuBtn {
  background: #e6f2ef;
  color: #1f4f4a;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
}

#menuDropdown {
  position: absolute;
  top: 110%;
  right: 0;

  background: white;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);

  padding: 6px;
  display: none;
  min-width: 140px;
}	

#menuDropdown button {
  display: block;
  margin: 10px auto;
  width: 120px;
}	
	
#menuWrapper button {
  background: #e6f2ef;
  color: #1f4f4a;
}

#menuWrapper button:hover {
  background: #a8cfc5;
}	
	
#message {
  display: none;
  position: fixed;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%) scale(0.9);

  background: #e6f2ef;   /* 👈 eau de nil */
  color: #1f4f4a;

  padding: 12px 18px;
  border-radius: 10px;

  font-size: 16px;
  font-weight: bold;

  opacity: 0;
  pointer-events: none;
  z-index: 5000;

  text-align: center;

  box-shadow: 0 4px 12px rgba(0,0,0,0.2); /* 👈 nice polish */
}

#message:empty {
  display: none;
}

#message.show {
  display: block;	
  animation: messagePop 1.6s ease forwards;
}

@keyframes messagePop {
  0%   { transform: translate(-50%, -40%) scale(0.8); opacity: 0; }
  15%  { transform: translate(-50%, -50%) scale(1.1); opacity: 1; }
  85%  { transform: translate(-50%, -55%) scale(1); opacity: 1; } 
  100% { transform: translate(-50%, -70%) scale(0.95); opacity: 0; }
}

#gameCodeModal {
  position: fixed;
  inset: 0;
  display: none;

  align-items: center;
  justify-content: center;

  background: rgba(0,0,0,0.6);
  z-index: 3000;
}

#gameCodeModal.show {
  display: flex;
}

#gameCodeText {
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 3px;

  color: #2a9d8f; /* 👈 your brand colour */
  background: #e6f2ef;

  padding: 12px;
  border-radius: 10px;
  margin: 12px 0;
}	

@media (max-width: 600px) {
  #gameCodeText {
    font-size: 16px;
    letter-spacing: 1px;
    word-break: break-all;
  }
}

#gameIdDisplay {
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 2px;

  color: #1f4f4a;
  background: #e6f2ef;

  padding: 8px 12px;
  border-radius: 10px;

  text-align: center;

  cursor: pointer;
  transition: all 0.15s ease;
}

#gameIdDisplay:hover {
  background: #a8cfc5;
}

#gameIdDisplay:active {
  transform: scale(0.96);
}


	