* {
  border: 0;
  margin: 0;
  box-sizing: border-box;
}

.page-loading {
  visibility: hidden;
}

.page-loaded {
  visibility: visible;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

body {
  min-height: 100vh;
  width: 100vw;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif, 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
  display: flex;
  justify-content: start;
  align-content: center;
  /* align-items: center; */
  flex-direction: column;
  font-size: 20px;
  background-color: #f8f9fa;
  overflow-x: hidden;
}

#startscreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 24px 16px;
  padding-bottom: 48px;
  margin: 0;
  box-sizing: border-box;
}

#gameboard {
  display: none;
  height: 100vh;
  width: 100%;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

/* Improved puzzle timer styling */
#puzzle-timer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 90%;
  max-width: 500px;
  height: 80px; /* Fixed height */
  font-size: 16px;
  background: white;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  margin: 16px auto; /* Center horizontally */
  position: relative;
  overflow: hidden;
  text-align: center; /* Center text */
}

#puzzle-timer div:first-child {
  font-size: 14px;
  margin-bottom: 4px;
}

#puzzle-timer-text {
  font-size: 24px; /* Smaller font size */
  font-weight: 700;
  color: #3b82f6;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
  line-height: 1;
}

.startscreen-body {
  width: 100%;
  text-align: center;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center; /* Center children */
  padding-bottom: 32px;
}

.startscreen-body h2 {
  margin-bottom: 8px;
}

.startscreen-row {
  height: auto;
  width: 100%;
  max-height: 250px;
  margin: 12px 0;
  align-items: center;
  align-content: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.startscreen-row-button {
  width: 90%;
  height: 60%;
  max-width: 500px;
  border-radius: 16px;
  background: white;
  color: #1f2937;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0;
  padding: 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.startscreen-row-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #3b82f6;
}

.startscreen-button-text {
  width: 70%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.startscreen-button-text h3 {
  font-size: 24px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 8px;
}

.startscreen-button-text p {
  font-size: 15px;
  color: #6b7280;
  margin: 0;
}

/* Common 3D button style */
.button-3d {
  position: relative;
  top: 0;
  transition: all 0.1s ease;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

.button-3d:hover {
  transform: translateY(-2px);
}

.button-3d:active {
  top: 4px;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0.2);
  transform: translateY(0);
}

/* Startscreen mode buttons */
.startscreen-mode-button {
  background: #3b82f6;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 16px;
  position: relative;
  top: 0;
  transition: all 0.1s ease;
  box-shadow: 0 4px 0 #1d4ed8;
}

.startscreen-row-button:hover .startscreen-mode-button {
  background: #2563eb;
  transform: translateY(-2px);
}

.startscreen-row-button:active .startscreen-mode-button {
  top: 4px;
  box-shadow: 0 0 0 #1d4ed8;
  transform: translateY(0);
}

.startscreen-stat-row {
  display: flex;
  flex-direction: row;
  text-align: center;
  width: 90%;
  max-width: 500px;
  background: white;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.startscreen-stat-container {
  display: flex;
  flex-direction: column;
  text-align: center;
  width: 33%;
}

.startscreen-stat-header {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.startscreen-stat-text {
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
}

#grid {
  height: 90vw;
  width: 90vw;
  max-width: 500px;
  max-height: 500px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
  padding: 4px;
}

.floating-container {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  height: 600px;
  max-width: 90vw;
  max-height: 90vh;
  padding: 20px;
  background-color: white;
  border-radius: 16px;
  border: none;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  z-index: 10;
}

#tutorial-div {
  z-index: 10;
  position: absolute;
  padding: 10px;
  background-color: #44d69e;
  background-color: rgb(129, 182, 140);
  background-color: #E6AA65;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  line-height: 2;
  font-size: 20px;
}

.floating-container .title {
  font-size: 75px;
  font-weight: 700;
  vertical-align: top;
  height: 25%;
  color: hsla(0, 0%, 96%, 0.4);
  border: solid 1px rgba(0, 0, 0, 0);
  line-height: .9;
}  

.floating-container .body {
  height: 60%;
  border: solid 1px rgba(0, 0, 0, 0);
  flex: 1;
  overflow-y: auto;
}

.floating-container .body h2 {
  font-size: 23px;
}

.floating-container .body p, li {
  font-size: 18px;
  margin-bottom: 10px;
}

.button-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height: 10%;
  cursor: pointer;
  margin-top: 10px;
  z-index: 100;
  vertical-align: bottom;
}

.button {
  font-weight: bold;
  border-radius: 5px;
  background-color: hsla(0, 0%, 96%, 0.4);
  width: 35%;
  height: 90%;
  font-size: medium;
  text-align: center;
  vertical-align: middle;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.filler {
  width: 50%;
}

.hintBox {
  height: auto;
  width: 95%;
  max-width: 400px;
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  margin: 20px auto;
}

#hint-header {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
  color: #1f2937;
}

#hint-description {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
  margin-bottom: 20px;
}

.hintBox .row {
  display: flex;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
}

.hintBox .cell {
  height: 32px;
  width: 32px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f3f4f6;
  color: #4b5563;
  transition: all 0.2s ease;
}

.hintBox .headerCol {
  height: 32px;
  width: 48px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #e5e7eb;
  color: #1f2937;
}

.hintBox .totalRow {
  background: #e5e7eb;
  color: #1f2937;
  font-weight: 600;
}


.hintBox .cell:hover {
  transform: scale(1.05);
  background: #e5e7eb;
}

@keyframes numberPop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.hintBox .cell:not(:empty) {
  animation: numberPop 0.3s ease forwards;
}

.row {
  height: 12.5%;
  height: 10%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 4px;
  opacity: 0;
  animation: fadeIn 0.5s ease forwards;
}

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

.mini-row {
  height: 20%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 4px;
}

.hintBox .row {
  height: 11.1%;
  width: 100%;
  max-width: 500px;
  max-height: 30px;
  display: flex;
  justify-content: space-around;
  container-name: row;
}

.cell {
  height: 100%;
  width: 12.5%;
  width: 10%;
  border-radius: 8px;
  background: rgba(135, 133, 133, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: clamp(20px, 4vw, 25px);
  color: white;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  animation: scaleIn 0.3s ease backwards;
  margin: 0;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* .cell:hover {
  background: rgba(135, 133, 133, 0.15);
  color: #1f2937;
} */

.mini-cell {
  height: 100%;
  width: 20%;
  border-radius: 8px;
  font-size: clamp(24px, 6vw, 36px);
  text-align: center;
  vertical-align: middle;
  font-weight: 700;
}

#info {
  height: 20vw;
  width: 90vw;
  max-width: 500px;
  max-height: 100px;
  display: grid;
  margin-top: 15px;
}

#input-info {
  grid-row: 1 / span 3;
  grid-column: 1 / span 3;
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  flex-direction: column;
  cursor: pointer;
}

#alphabetic-keys, #other-keys {
  width: 90vw;
  max-width: 500px;
  color: black;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Add padding to prevent overflow */
  padding: 0 8px;
  margin-bottom: 20px;
  /* Ensure consistent height */
  height: min(12vw, 60px);
}

#alphabetic-keys {
  margin-bottom: 20px;
}

#other-keys {
  justify-content: space-evenly;
}

.other-key {
  background-color: #3b82f6;
  height: 100%;
}

.other-key i {
  color: white;
}

#timer, .alphabetic-key, .header-letter, #backspace-key, #check-key, #shuffle-key, #share-button, #clear-button, #scoreDiv {
  display: flex;
  align-items: center;
  justify-content: center;
}

.alphabetic-key {
  /* Change fixed width/height to aspect ratio approach */
  width: min(12vw, 60px);
  aspect-ratio: 1;
  position: relative;
  border-radius: 8px;
  /* Make font size responsive */
  font-size: clamp(20px, 5vw, 40px);
  font-weight: 700;
  background-color: #4b5563;
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
  position: relative;
  top: 0;
  box-shadow: 0 4px 0 #1d4ed8;
  /* Center text */
  display: flex;
  align-items: center;
  justify-content: center;
}

.alphabetic-key:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15);
}

#backspace-key,
#shuffle-key,
#check-key {
  width: 18vw;
  height: 10vw;
  max-width: 100px;
  max-height: 50px;
  position: relative;
  border-radius: 8px;
  margin: 5px;
  background-color: #6b7280;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.15s ease;
  position: relative;
  top: 0;
  transition: all 0.1s ease;
  box-shadow: 0 4px 0 #1d4ed8;
}

#check-key img,
#backspace-key img,
.alphabetic-key img,
#share-button img {
  position:absolute;
  height: 100%;
  width: 100%;
}

.good-word {
  background: #22c55e;
  color: white;
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.bad-word {
  background: #f59e0b;
  background-color: #ecbb47;
  background-color: #E6AA65;
  color: #3d3c3c;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.highlighted-row {
  background: rgba(0, 0, 0, 0.05);
  background: rgba(59, 58, 58, 0.353);
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.start-end {
  background: #3b82f6;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.clicked-cell {
  background: rgba(252, 252, 252, 0.854) !important;
  color: #1f2937;
  font-weight: 600;
}

#share-game-button {
  background-color: #3b82f6;
  color: white;
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  top: 0;
  transition: all 0.1s ease;
  box-shadow: 0 4px 0 #1d4ed8;
  margin: 0 auto; /* Center horizontally */
  width: auto; /* Allow natural width */
  text-align: center;
}

#share-game-button span {
  display: inline-block; /* Ensure text is properly centered */
}

#share-game-button:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

#share-game-button:active {
  top: 4px;
  box-shadow: 0 0 0 #1d4ed8;
  transform: translateY(0);
}

#end-game-button {
  background-color: #2196F3;
  background-color: #81b68c;
  width: 200px;
  height: 10vw;
  max-height: 50px;
  align-items: center;
  text-align: center;
  border-radius: 3px;
  cursor:pointer;
  font-size: 17px;
  display: none;
  justify-content: center;
  font-weight: bold;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  top: 0;
  transition: all 0.1s ease;
  box-shadow: 0 4px 0 #1d4ed8;
}

#new-game-button {
  background-color: #2196F3;
  width: 200px;
  height: 50px;
  align-items: center;
  text-align: center;
  border-radius: 20px;
  cursor:pointer;
  font-size: 17px;
  display: none;
  justify-content: center;
  background-color: #E6AA65;
  border: 1px solid #ccc;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  top: 0;
  transition: all 0.1s ease;
  box-shadow: 0 4px 0 #1d4ed8;
}

#startscreen-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 80px;
  background: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  z-index: 100;
}

@media (max-width: 480px) {
  #startscreen-header {
    padding: 0 8px;
  }
}

#header {
  width: 100%;
  max-width: 500px;
  height: 60px;
  color: black;
  display: flex;
  flex-direction: row;
  margin: 1vw 0;
  font-size: 10px;
}

#logo  {
  width: 80%;
  vertical-align: middle;
}

#logo-box {
  width: 50%;
  height: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  display: flex;
}

#startscreen-logo-box {
  width: 200px;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

#startscreen-logo {
  width: 100%;
  height: auto;
  object-fit: contain;
}

#back-button {
  width: 25%;
  height: 100%;
  align-items: center;
  text-align: center;
  cursor:pointer;
  display: flex;
  justify-content: center;
}

#icons {
  display: flex;
  gap: 16px;
  align-items: center;
}

.icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.icon:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.material-icons {
  text-align: center;
}

.material-symbols-rounded {
  font-variation-settings:
  'FILL' 1,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24
}

.palavra {
  background: rgba(9, 150, 255, 0.9);
}

#score {
  text-align: center;
  width: 90vw;
  max-width: 500px;
  max-height: 500px;
  font-size: 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content:flex-start;
  margin-bottom: 10px;
  vertical-align: middle;
  color: black;
  font-weight: 600;
}

#share-button {
  width: 100%;
  max-width: 200px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2);
  margin: 0 auto;
  position: relative;
  top: 0;
}

#share-button:active {
  top: 4px;
  box-shadow: 0 0 0 #1d4ed8;
  transform: translateY(0);
}

#share-button i {
  font-size: 20px;
  transition: transform 0.2s ease;
}

#share-button:hover i {
  transform: translateX(2px);
}

#share-button-text {
  font-size: 16px;
  margin: 0;
  padding: 0;
}

#win-buttons {
  margin-top: 24px;
  width: 100%;
}

#share-text, #share-icon {
  vertical-align: middle;
}

#scoreDiv {
  height: auto;
  width: 100%;
  max-width: 500px;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border-radius: 16px;
  padding: 12px;
  margin: 0 8px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
              0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.score-col {
  width: 25%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  position: relative;
}

#score-header, #timer-header, #word-header, #palavra-header {
  color: rgba(255, 255, 255, 0.7);
  font-size: clamp(12px, 2.5vw, 16px);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

#score-text, #timer-text, #word-text, #palavra-text {
  color: white;
  font-size: clamp(16px, 3.5vw, 24px);
  font-weight: 600;
  line-height: 1;
}

#palavra-text .material-symbols-rounded {
  font-size: clamp(16px, 3.5vw, 24px);
  background: linear-gradient(45deg, #fbbf24, #d97706);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

@keyframes scoreUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.score-update {
  animation: scoreUpdate 0.3s ease;
}

.score-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 24px;

}

.scorebox-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  min-height: 80px;
}

.win-title {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}

.win-text {
  font-size: 20px;
  font-weight: 700;
  color: #1f2937;
}

#grid-text {
  width: min(300px, 80vw);
  aspect-ratio: 1;
  margin: 20px auto;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  gap: 2px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

#grid-text .cell {
  aspect-ratio: 1;
  width: 100%;
  border-radius: 2px;
  font-size: min(16px, 3vw);
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
}

#grid-text.mini-grid {
  width: min(280px, 70vw);
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
}

#grid-text.mini-grid .cell {
  font-size: clamp(24px, 6vw, 36px);
}

#grid-text .row {
  display: contents;
}

#score-box {
  margin-bottom: 50px;
}

.scorebox-col {
  width: 30%;
  display: flex;
  flex-direction: column;
  justify-content: start;
  text-align: center;
  align-items: center;
}

#scorebox-text, #wordbox-text {
  font-size: 50px;
  text-wrap: wrap;
  text-align: center;
}

#scorebox-text2, #wordbox-text2 {
  font-size: 20px;
  text-wrap: wrap;
  text-align: center;
}

#win-message {
  display: flex;
  flex-direction: row;
  width: 100%;
  justify-content: center;
  text-align: center;
  margin-bottom: 20px;
}

.bottom-row {
  width: 100%;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

#leaderboard, #achievement-button, #startscreen-settings, #settings, #language {
  cursor: pointer;
}

.modal {
  display: none;
  position: fixed;
  z-index: 100; 
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgb(0,0,0);
  background-color: rgba(0,0,0,0.4);
  transition: all ease 1s;
}

.modal-content {
  background-color: white;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: none;
  margin: 5% auto;
  padding: 24px;
  width: 80%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 20px;
  justify-content: center;
  text-align: center;
}

.modal-content li {
  font-size: 20px;
}

#hint-modal .modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 20px;
  border: 1px solid #888;
  width: 80%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  align-self: flex-end;
}

#timer {
  display: block;
}

#time-col {
  display: flex;
}

#win-screen-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  align-self:flex-end;
}

#hint-close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  align-self:flex-end;
}

.close:hover,
.close:focus {
  color: black;
  text-decoration: none;
  cursor: pointer;
}

#hint-modal .cell {
  font-weight: normal;
  color: black;
  border-radius: 0%;
}

#hint-modal .headerCol, .totalRow {
  font-weight: bold;
  background-color: #f1f1f1;
}

#hint-modal .totalRow {
  font-weight: bold;
  background-color: #f1f1f1;
}

.achievement-modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: 100%;
  max-width: 600px;
  height: 85vh;
  background-color: #f8f9fa;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  transform: translateY(100%) translateX(-50%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

.achievement-modal.show {
  transform: translateY(0) translateX(-50%);
}

.achievement-header {
  position: sticky;
  top: 0;
  padding: 20px;
  background-color: #f8f9fa;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

.achievement-section {
  padding: 16px;
  margin-bottom: 16px;
}

.section-header {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.section-header:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.achievement-row {
  background: white;
  border-radius: 8px;
  padding: 16px;
  margin: 8px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
}

.achievement-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.achievement-row-body {
  flex: 1;
  padding-right: 16px;
}

.achievement-name {
  color: #1f2937;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.achievement-description {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.4;
}

.achievement-status {
  width: 32px;
  height: 32px;
  background: #f3f4f6;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.achievement-status img {
  width: 24px;
  height: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.achievement-status img[style*="display: block"] {
  opacity: 1;
}

.progress-bar {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar-container {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-color {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.progress-bar-stats {
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  min-width: 48px;
  text-align: right;
}

.settings-modal {
  position: fixed;
  bottom: 0;
  left: 50%;
  width: 95%;
  max-width: 600px;
  height: auto;
  max-height: 85vh;
  overflow-y: auto;
  background-color: #fff;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  transform: translateY(110%) translateX(-50%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  border-radius: 16px 16px 0 0;
  padding-bottom: 24px;
}

.settings-modal.show {
  transform: translateY(0) translateX(-50%);
}

.settings-header {
  position: sticky;
  top: 0;
  padding: 20px;
  background-color: white;
  font-weight: 600;
  font-size: 24px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  z-index: 2;
}

.settings-body {
  padding: 16px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  color: #1f2937;
  font-size: 16px;
  transition: all 0.2s ease;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row:hover {
  background-color: #f3f4f6;
}

.settings-row a {
  color: inherit;
  text-decoration: none;
  width: 100%;
}

.switch {
  position: relative;
  width: 48px;
  height: 24px;
}

.slider {
  background-color: #e5e7eb;
}

.slider:before {
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked + .slider {
  background-color: #3b82f6;
}

input:checked + .slider:before {
  transform: translateX(24px);
}

.switch {
  position: fixed;
  right: 10px;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #eeeeee;
  -webkit-transition: .2s;
  transition: .2s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: rgb(85, 85, 85);
  -webkit-transition: .4s;
  transition: .4s;
}

input:checked + .slider {
  background-color: #2196F3;
}

input:focus + .slider {
  box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
  -webkit-transform: translateX(20px);
  -ms-transform: translateX(20px);
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  color: #6b7280;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
  z-index: 10;
}

.close-button:hover {
  color: #1f2937;
}

#settings-close,
#achievement-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.popup {
  display: none;
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  z-index: 2000;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
              0 4px 6px -2px rgba(0, 0, 0, 0.05);
  animation: slideDown 0.5s ease forwards;
}

#popup-header {
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
}

#popup-text {
  font-size: 18px;
  font-weight: 600;
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.popup.hide {
  animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 0);
    opacity: 1;
  }
  to {
    transform: translate(-50%, -100%);
    opacity: 0;
  }
}

.tutorial-content {
  max-width: 450px;
  padding: 32px;
  position: relative;
}

.tutorial-content h2 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 32px;
  color: #1f2937;
  text-align: center;
}

.tutorial-section h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 24px;
  color: #374151;
  text-align: center;
}

.five-by-five {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 12px;
  margin: 24px auto;
  max-width: 320px;
}

.five-by-five .cell {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  background: white;
  border-radius: 4px;
}

.five-by-five .cell.start-end {
  background: #3b82f6;
  color: white;
}

.five-by-five .cell::before {
  content: attr(data-letter);
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 600;
}

.keyboard-example {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 24px 0 0 0;
}

.example-key {
  width: 40px;
  height: 40px;
  background: #4b5563;
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
}

.good-letter {
  background: #22c55e !important;
  color: white !important;
  position: relative;
  width: 100%;
  padding-bottom: 100%;
}

#reset-game-modal.show {
  display: flex;
}

#reset-game-modal {
  max-width: 320px;
  max-height: 320px;
  aspect-ratio: 1;
  text-align: center;
  padding: 24px;
  display: none;
  flex-direction: column;
  justify-content: space-between;
}

#reset-game-modal .title {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 12px;
}

#reset-game-modal .body {
  margin: auto 0;
}

#reset-game-modal h2 {
  font-size: 15px;
  color: #4b5563;
  line-height: 1.4;
}

#reset-game-modal .button-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: auto;
  padding: 8px 0;
}

#reset-game-modal .button {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
  min-height: 40px;
}

#btn-continue-game {
  background: #e5e7eb;
  color: #1f2937;
}

#btn-reset {
  background: #ef4444;
  color: white;
}

#btn-continue-game:hover {
  background: #d1d5db;
  transform: translateY(-1px);
}

#btn-reset:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.startscreen-body h2 {
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  margin: 32px 0 16px;
  text-align: center;
  position: relative;
}

.startscreen-body h2::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background: #3b82f6;
  border-radius: 2px;
}

/* Tutorial Modal Styles */
#how-to-play-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow-y: auto;
}

.tutorial-content {
  position: relative;
  background: white;
  width: 90%;
  max-width: 500px;
  height: 90vh;
  margin: 5vh auto;
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevent content from spilling out */
}

.tutorial-slides {
  position: relative;
  flex: 1;
  width: 100%;
  overflow-y: auto; /* Enable vertical scrolling */
  margin: 24px 0;
  padding-right: 16px; /* Space for scrollbar */
}

.tutorial-slide {
  position: relative; /* Changed from absolute */
  width: 100%;
  height: auto; /* Allow content to determine height */
  opacity: 0;
  display: none;
  flex-direction: column;
}

.tutorial-slide.active {
  opacity: 1;
  display: flex;
}

.tutorial-nav {
  position: relative;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: white; /* Ensure nav stays above content */
}

.tutorial-content h2 {
  font-size: clamp(24px, 5vw, 28px);
  font-weight: 600;
  margin-bottom: 24px;
  color: #1f2937;
  text-align: center;
}

.tutorial-section ul {
  list-style-type: none;
  padding: 0;
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tutorial-section li {
  font-size: clamp(14px, 4vw, 16px);
  line-height: 1.6;
  color: #4b5563;
  padding-left: 24px;
  position: relative;
}

.tutorial-section li::before {
  content: "•";
  position: absolute;
  left: 8px;
  color: #3b82f6;
}

/* Tutorial Grid */
.five-by-five {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 16px;
  background: #f3f4f6;
  border-radius: 12px;
  margin: 24px auto;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
}

.five-by-five .cell {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Example Keyboard */
.keyboard-example {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 24px 0;
  flex-wrap: wrap;
  padding: 0 8px;
}

.example-key {
  width: clamp(32px, 8vw, 40px);
  height: clamp(32px, 8vw, 40px);
  background: #4b5563;
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Close button */
.tutorial-content .close-button {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  font-size: 24px;
  color: #6b7280;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.tutorial-content .close-button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1f2937;
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .tutorial-content {
    height: 90vh;
    margin: 5vh auto;
    padding: 20px 16px;
  }
}

/* Game controls styling */
#other-keys {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap; /* Allow wrapping on small screens */
}

.other-key {
  width: clamp(48px, 12vw, 60px);
  height: clamp(48px, 12vw, 60px);
  border-radius: 12px;
  background: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.other-key i {
  font-size: clamp(24px, 6vw, 32px);
  color: white;
  transition: all 0.2s ease;
}

.other-key:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

/* Game buttons (New Game, Share Score, etc.) */
#share-game-button,
#end-game-button,
#new-game-button {
  padding: clamp(12px, 3vw, 16px) clamp(20px, 5vw, 28px);
  border-radius: 12px;
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 600;
  background: #3b82f6;
  color: white;
  transition: all 0.2s ease;
  display: none;
  position: relative;
  top: 0;
  transition: all 0.1s ease;
  box-shadow: 0 4px 0 #1d4ed8;
}

#share-game-button:hover,
#end-game-button:hover,
#new-game-button:hover {
  background-color: #2563eb;
  transform: translateY(-2px);
}

#share-game-button:active,
#end-game-button:active,
#new-game-button:active {
  top: 4px;
  box-shadow: 0 0 0 #1d4ed8;
  transform: translateY(0);
}

/* Icon styling for help button */
.icon i {
  color: #6b7280;
  transition: color 0.2s ease;
}

.icon:hover i {
  color: #1f2937;
}

/* Game controls icons (backspace and shuffle) */
.other-key {
  background: #3b82f6;
}

.other-key i {
  font-size: clamp(24px, 6vw, 32px);
  color: white;
  transition: all 0.2s ease;
}

.other-key:hover {
  background: #2563eb;
  transform: translateY(-2px);
}




/* Pal container styles */
.pal-container {
  width: 100%;
  max-width: 500px;
  height: 100px; /* Fixed height */
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  margin-top: 100px;
}

.pal-image {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.pal-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: bottom center;
  transition: transform 0.3s ease;
}

.pal-image img.waddle {
  animation: waddle 1s ease-in-out;
}

.pal-image img.hop {
  animation: hop 0.5s ease-in-out;
}

.pal-message {
  flex: 1;
  max-width: 280px;
  height: 80px; /* Fixed height */
}

.message-bubble {
  background: white;
  padding: 16px;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  height: 100%; /* Fill parent height */
  display: flex;
  align-items: center;
  overflow: hidden; /* Prevent content overflow */
}

.message-bubble::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 10px 10px 10px 0;
  border-color: transparent white transparent transparent;
}

.message-bubble p {
  margin: 0;
  font-size: clamp(12px, 4vw, 16px);
  color: #1f2937;
  line-height: 1.4;
  width: 100%;
  text-align: left;
  overflow-wrap: break-word;
  hyphens: auto;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Limit to 3 lines */
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Pal animations */
@keyframes waddle {
  0% {
    transform: rotate(-3deg) translateY(0);
  }
  25% {
    transform: rotate(0deg) translateY(-2px);
  }
  50% {
    transform: rotate(3deg) translateY(0);
  }
  75% {
    transform: rotate(0deg) translateY(-2px);
  }
  100% {
    transform: rotate(-3deg) translateY(0);
  }
}

.pal-image img {
  animation: waddle 3s ease-in-out infinite;
  transform-origin: bottom center;
}

/* Smoother pulse animation */
@keyframes gentle-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pal-hint.pulse {
  animation: gentle-pulse 2s ease-in-out infinite;
}

/* Adjust container padding for smaller screens */
@media (max-width: 480px) {
  .pal-container {
    padding: 12px 16px;
  }
  
  .pal-message {
    max-width: 220px; /* Smaller on mobile */
  }
}

/* Tutorial modal styles */
.tutorial-slides {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.tutorial-slide {
  position: absolute;
  width: 100%;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
}

.tutorial-slide.active {
  opacity: 1;
  transform: translateX(0);
}

.pal-tutorial-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.pal-tutorial {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.tutorial-bubble {
  background: white;
  padding: 16px;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  flex: 1;
}

.tutorial-bubble::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 10px 10px 10px 0;
  border-color: transparent white transparent transparent;
}

.tutorial-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

.nav-dots {
  display: flex;
  gap: 8px;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  transition: all 0.2s ease;
}

.nav-dot.active {
  background: #3b82f6;
  transform: scale(1.2);
}

.nav-buttons {
  display: flex;
  gap: 16px;
}

.nav-button {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-button:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.nav-button:not(:disabled):hover {
  background: #2563eb;
  transform: translateY(-2px);
}

/* Tutorial grid cell styles */
.tutorial-grid .cell {
  position: relative;
  width: 100%;
  padding-bottom: 100%;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-grid .cell::before {
  content: attr(data-letter);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
  color: white;
}

.tutorial-grid .start-end {
  background: #93c5fd;
}

.tutorial-grid .good-letter {
  background: #f3f4f6;
}

.tutorial-grid .highlight {
  background: #93c5fd;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 0.8; }
  50% { opacity: 1; }
  100% { opacity: 0.8; }
}

/* First slide specific styles */
.tutorial-slide[data-slide="1"], .tutorial-slide[data-slide="2"] {
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.tutorial-slide[data-slide="1"] .pal-tutorial-container, .tutorial-slide[data-slide="2"] .pal-tutorial-container {
  flex-direction: column-reverse;
  gap: 24px;
  margin: 0;
}

.tutorial-slide[data-slide="1"] .pal-tutorial, .tutorial-slide[data-slide="2"] .pal-tutorial {
  width: 200px;
  height: 200px;
  object-fit: contain;
}

.tutorial-slide[data-slide="1"] .tutorial-bubble, .tutorial-slide[data-slide="2"] .tutorial-bubble {
  width: 100%;
  max-width: 300px;
  text-align: center;
}

.tutorial-slide[data-slide="1"] .tutorial-bubble::before, .tutorial-slide[data-slide="2"] .tutorial-bubble::before {
  left: 50%;
  top: 100%;
  transform: translateX(-50%) rotate(90deg);
}

@keyframes gentle-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .tutorial-slide[data-slide="1"] .pal-tutorial {
    width: 160px;
    height: 160px;
  }
}

/* Tutorial content layout */
.tutorial-slide {
  display: none;
  height: 100%;
  flex-direction: column;
}

.tutorial-slide.active {
  display: flex;
  opacity: 1;
}

/* Container for scrollable content */
.tutorial-interactive-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 16px; /* Space for scrollbar */
  margin: 16px 0;
}

/* Fixed header and footer */
.pal-tutorial-container {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.tutorial-nav {
  flex-shrink: 0;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  background: white;
}

/* Grid and keyboard container */
.tutorial-grid {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  margin: 24px auto;
}

.keyboard-example {
  margin: 24px auto;
  max-width: 320px;
}

/* Final slide styles */
.tutorial-slide[data-slide="7"] {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 32px;
}

.tutorial-slide[data-slide="7"] .pal-tutorial {
  width: 200px;
  height: 200px;
}

.play-button {
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 32px;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 32px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.play-button:hover {
  background: #2563eb;
  transform: translateY(-2px);
}

.play-button i {
  font-size: 24px;
}

/* Pal hint button styles */
.pal-hint {
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto; /* Push to right side */
  width: 50px;
  height: 50px;
}

.pal-hint img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.pal-hint::after {
  content: 'Hint';
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.pal-hint:hover {
  transform: scale(1.1);
}

.pal-hint:hover::after {
  opacity: 1;
}

/* Pulse animation to draw attention */
@keyframes gentle-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.pal-hint.pulse {
  animation: gentle-pulse 2s ease-in-out infinite;
}

/* Word Search Modal */
.word-search-content {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 90vh;
  padding: 20px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: #f8f9fa;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

/* Add slide up animation when modal is shown */
#word-search-modal {
  background: rgba(0, 0, 0, 0.5);
  transition: background-color 0.3s ease;
}

#word-search-modal.show .word-search-content {
  transform: translateY(0);
}

/* Adjust the word search area to scroll within the modal */
.word-search-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Close button styling */
.close-modal-button {
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.1s ease;
  box-shadow: 0 4px 0 #b91c1c;
  position: relative;
  top: 0;
}

.close-modal-button:hover {
  background: #dc2626;
}

.close-modal-button:active {
  top: 4px;
  box-shadow: 0 0 0 #b91c1c;
  transform: translateY(0);
}

.pal-hint-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.pal-hint-image {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.hint-bubble {
  background: white;
  padding: 16px;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  flex: 1;
}

.hint-bubble p {
  margin: 0;
  font-size: clamp(14px, 3.5vw, 16px); /* Reduced responsive font size */
  color: #1f2937;
  word-wrap: break-word;
  hyphens: auto;
}

.hint-bubble::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 10px 10px 10px 0;
  border-color: transparent white transparent transparent;
}

.word-search-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: calc(100vh - 220px); /* Leave room for header */
}

.word-slots {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 16px;
}

.letter-slot {
  width: 40px;
  height: 40px;
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  background: white;
}

.letter-slot.filled {
  border-style: solid;
  border-color: #3b82f6;
  background: #eff6ff;
}

.available-letters {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding: 16px;
}

.draggable-letter {
  width: 40px;
  height: 40px;
  background: #3b82f6;
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  cursor: move;
  user-select: none;
  transition: transform 0.2s ease;
}

.draggable-letter:hover {
  transform: translateY(-2px);
}

.draggable-letter.dragging {
  opacity: 0.5;
}

.word-results {
  flex: 1;
  background: white;
  border-radius: 16px;
  padding: 16px;
  overflow-y: auto;
  max-height: 400px; /* Fixed height for scrolling */
}

.results-header {
  font-size: 18px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 16px;
}

.results-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  padding: 0 8px;
}

.length-header {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  padding: 16px 8px 8px;
}

.word-result {
  padding: 8px;
  background: #f3f4f6;
  border-radius: 8px;
  font-size: 14px;
  color: #1f2937;
  text-align: center;
}

.word-result {
    padding: 8px 16px;
    background: #f3f4f6;
    border-radius: 8px;
    font-size: 16px;
    color: #1f2937;
    text-align: center;
}

.letter-slot.hover {
  border-color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
  transform: scale(1.05);
}

.modal-header {
  font-size: 24px;
  font-weight: 700;
  color: #1f2937;
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e5e7eb;
  position: relative;
}

.modal-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: #3b82f6;
  border-radius: 2px;
}

/* Win modal styling */
.pal-win-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: nowrap; /* Prevent wrapping */
}

.pal-win-image {
  width: 80px;
  height: 80px;
  object-fit: contain;
  flex-shrink: 0; /* Prevent image from shrinking */
}

.win-bubble {
  background: white;
  padding: 16px;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  flex: 1;
  min-width: 0; /* Allow bubble to shrink below content size */
}

.win-bubble h2 {
  margin: 0;
  font-size: clamp(14px, 3.5vw, 16px); /* Reduced responsive font size */
  color: #1f2937;
  word-wrap: break-word;
  hyphens: auto;
  line-height: 1.3; /* Better line spacing for readability */
}

/* Media queries for smaller screens */
@media (max-width: 480px) {
  .pal-win-container {
    gap: 8px; /* Reduce gap on small screens */
  }
  
  .pal-win-image {
    width: 60px; /* Smaller image on small screens */
    height: 60px;
  }
  
  .win-bubble {
    padding: 12px; /* Smaller padding on small screens */
  }
  
}

/* Update existing win modal styles */
#win-screen .modal-content {
  display: flex;
  flex-direction: column;
  padding: 24px;
}



/* Compact grid-text for win modal */
#grid-text {
  transform: scale(0.85);
  transform-origin: center top;
  margin-top: 20px;
  max-width: 100%;
  overflow: hidden;
}

#grid-text .grid-row {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-bottom: 2px;
}

#grid-text .grid-cell {
  width: 28px;
  height: 28px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

/* Further reduce size on small screens */
@media (max-width: 480px) {
  #grid-text {
    transform: scale(0.75);
  }
  
  #grid-text .grid-cell {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

/* Pal active cell indicator */
#pal-active-cell {
  position: absolute;
  width: 50px;
  height: 50px;
  pointer-events: none; /* Allow clicks to pass through */
  opacity: 0;
  transition: all 0.3s ease;
  transform: translateY(10px);
}

#pal-active-cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#pal-active-cell.show {
  opacity: 1;
  transform: translateY(0);
}

/* Add responsive margin for smaller screens */
@media (max-width: 360px) {
  .alphabetic-key {
    font-size: clamp(16px, 4vw, 20px);
  }
  
  #alphabetic-keys {
    padding: 0 4px;
  }
}

/* Amazon Book Banner Styles */
.amazon-book-banner {
    width: 90%;
    max-width: 500px;
    background: #fff;
    border-radius: 12px;
    margin: 16px 0;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    border: 2px solid #FFD814;
    position: relative;
    overflow: hidden;
}

.amazon-book-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #232F3E;
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 12px;
    border-bottom-left-radius: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.amazon-book-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.amazon-book-image {
    width: 90px;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.amazon-book-info {
    flex: 1;
}

.amazon-book-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 4px;
    color: #232F3E;
}

.amazon-book-description {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 12px;
}

.amazon-book-button {
    background: linear-gradient(to bottom, #FFD814, #F7CA00);
    border: 1px solid #FCD200;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: bold;
    font-size: 14px;
    color: #0F1111;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.amazon-book-button:hover {
    background: linear-gradient(to bottom, #F7CA00, #F2C200);
}

@media (max-width: 480px) {
    .amazon-book-content {
        flex-direction: column;
        text-align: center;
    }
    
    .amazon-book-image {
        margin-bottom: 12px;
    }
}

/* Authentication Styles */
.auth-container {
  display: flex;
  align-items: center;
  margin-left: auto;
  margin-right: 8px;
}

.auth-button {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
}

.auth-button:hover {
  background: #2563eb;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.auth-button:active {
  transform: translateY(0);
}

.auth-button .material-icons {
  font-size: 18px;
}

.auth-button-text {
  font-size: 14px;
  font-weight: 500;
}

.logout-btn {
  background: #6b7280;
}

.logout-btn:hover {
  background: #4b5563;
}

/* Mobile responsiveness for auth */
@media (max-width: 480px) {
  .auth-container {
    margin-right: 4px;
  }
  
  .auth-button {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 6px;
  }
  
  .auth-button .material-icons {
    font-size: 16px;
  }
  
  .auth-button-text {
    font-size: 12px;
  }
  
  /* Hide text on very small screens, show only icon */
  @media (max-width: 360px) {
    .auth-button-text {
      display: none;
    }
    
    .auth-button {
      padding: 8px;
      border-radius: 50%;
      width: 32px;
      height: 32px;
      justify-content: center;
    }
  }
}

/* Auth Modals */
.auth-modals {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
}

.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  pointer-events: none;
}

.auth-modal.show {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}

.auth-modal-content {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  width: 90%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.auth-modal.show .auth-modal-content {
  transform: scale(1);
}

.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0 24px;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 16px;
}

.auth-modal-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #1f2937;
}

.auth-close-btn {
  background: none;
  border: none;
  color: #6b7280;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.auth-close-btn:hover {
  background: #f3f4f6;
  color: #374151;
}

.auth-modal-body {
  padding: 24px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form-group label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.auth-form-group input {
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 16px;
  transition: all 0.2s ease;
  background: white;
}

.auth-form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-submit-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.auth-submit-btn:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.auth-link-btn {
  background: none;
  border: none;
  color: #3b82f6;
  cursor: pointer;
  font-size: 14px;
  text-align: center;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.auth-link-btn:hover {
  background: #f0f9ff;
  color: #1d4ed8;
}

/* Loading animation */
.rotating {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Notifications */
.auth-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: white;
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #ef4444;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 10001;
  max-width: 300px;
}

.auth-notification.success {
  border-left-color: #10b981;
}

.auth-notification.show {
  transform: translateX(0);
}

/* Mobile responsiveness for auth */
@media (max-width: 480px) {
  .auth-container {
    margin-right: 4px;
  }
  
  .auth-button {
    padding: 6px 8px;
    font-size: 12px;
    border-radius: 6px;
  }
  
  .auth-button .material-icons {
    font-size: 16px;
  }
  
  .auth-button-text {
    font-size: 12px;
  }
  
  /* Hide text on very small screens, show only icon */
  @media (max-width: 360px) {
    .auth-button-text {
      display: none;
    }
    
    .auth-button {
      padding: 8px;
      border-radius: 50%;
      width: 32px;
      height: 32px;
      justify-content: center;
    }
  }
  
  .auth-modal-content {
    width: 95%;
    margin: 20px;
  }
  
  .auth-modal-header {
    padding: 20px 20px 0 20px;
  }
  
  .auth-modal-body {
    padding: 20px;
  }
  
  .auth-notification {
    right: 10px;
    left: 10px;
    max-width: none;
  }
}

