* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Cairo', sans-serif;
  background-color: #1c0f2f;
  color: white;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: start;
  min-height: 100vh;
  padding: 20px;
  padding-top: 100px;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('img/bg.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  filter: blur(32px);
  z-index: -1;
}

h1 {
  color: gold;
  margin-bottom: 20px;
}

.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 100;
}

.nav-logo img {
  margin-top: 12px;
  height: 24px;
}

.nav-icon {
  position: absolute;
  right: calc(50% + 240px);
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid white;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

.nav-icon:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.05);
}

.nav-history-icon {
  position: absolute;
  right: calc(50% + 280px);
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: white;
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid white;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background-color 0.3s, transform 0.2s;
}

.nav-history-icon:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-50%) scale(1.05);
}

.date-picker {
  padding: 8px;
  background: linear-gradient(145deg, #7b40bd, #9a5eea);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  margin-top: 10px;
}

.boards-container {
  display: flex;
  flex-direction: row;
  gap: 32px;
  max-width: 1000px;
  width: 100%;
  justify-content: center;
  margin-bottom: 20px;
}

.board-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.3s;
}

.board-container.inactive {
  opacity: 0.5;
  pointer-events: none;
}

.correct-word {
  width: 208px; /* 5 tiles * 40px + 4 gaps * 4px */
  background-color: #4CAF50;
  color: white;
  padding: 8px;
  text-align: center;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: bold;
}

.board {
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  gap: 4px;
}

.row {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  gap: 4px;
}

.tile {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  background-color: rgba(255, 255, 255, 0.251);
  color: white;
  text-transform: uppercase;
  border: 2px solid transparent;
  transition: border 0.2s;
}

.tile.filled {
  border-color: #a621ff;
}

.tile.correct {
  background-color: #4CAF50;
  color: white;
  border: none;
}

.tile.present {
  background-color: #FFC107;
  color: black;
  border: none;
}

.tile.absent {
  background-color: #888;
  color: white;
  border: none;
}

.tile.incomplete {
  border: 2px solid red !important;
}

.tile.flip {
  animation: flipTile 0.6s ease forwards;
  transform-origin: center;
}

@keyframes flipTile {
  0% { transform: rotateY(0deg) scaleX(1); }
  100% { transform: rotateY(180deg) scaleX(-1); }
}

.tile.flip {
  direction: rtl;
}

.tile.flip::first-letter {
  transform: scaleX(-1);
  display: inline-block;
}

.play-here-btn {
  margin-top: 10px;
  padding: 8px 16px;
  background: linear-gradient(145deg, #7b40bd, #9a5eea);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

.play-here-btn:hover {
  background: linear-gradient(145deg, #9a5eea, #7b40bd);
  transform: scale(1.05);
}

.play-here-btn:active {
  transform: scale(0.95);
}

.play-here-btn.active {
  background: #4CAF50;
}

.keyboard {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
  max-width: 700px;
  width: 100%;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}


/*
.key {
  display: flex;
  justify-content: center;
  align-items: center;
  background: none; /* إزالة الخلفية الافتراضية للزر */
  /*border: none;
  border-radius: 8px;
  padding: 0; /* إزالة الحشوة الافتراضية */
  /*font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  min-width: 40px;
  height: 48px; /* ارتفاع ثابت للزر */
  /* box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}*/

.key:hover {
  background: linear-gradient(145deg, #9a5eea, #7b40bd);
}

.key:active {
  transform: scale(0.92);
}

.key.key-absent {
  background: #ffffff08 !important;
  color: white !important;
  box-shadow: none !important;
}

.key.key-absent:hover {
  background: #6d35a83c !important;
}

.key.key-absent:active {
  transform: scale(0.92);
}

.key-enter {
  background: #4CAF50;
  color: white !important;
  padding: 12px 32px;
  border: none;
}

.key-enter:hover {
  background: #45a049;
}

.key-delete {
  background: #ff5c5c;
  color: white !important;
  padding: 12px 32px;
  border: none;
}

.key-delete:hover {
  background: #e04f4f;
}

.message {
  margin-top: 10px;
  font-size: 18px;
  color: gold;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  z-index: 1000;
}

.modal-content {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 16px;
  text-align: center;
  max-width: 800px;
  width: 90%;
  color: white;
}

.modal-close {
  background-color: #4b2672;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 15px;
  transition: background-color 0.3s;
}

.modal-close:hover {
  background-color: #6c35a8;
}

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.slide-down {
  opacity: 0;
  transform: translateY(-30px);
  animation: slideDown 0.6s ease forwards;
}

@keyframes slideDown {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: linear-gradient(to bottom, #2d0b55, #6b3fc5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, #a621ff, #6b3fc5);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to top, #a621ff, #6b3fc5);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.nav-btn {
  background-color: #7b40bd;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
}

.nav-btn:hover {
  background-color: #9a5eea;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 20px;
}

.calendar-day {
  padding: 10px;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  cursor: pointer;
}

.calendar-day:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.calendar-day.disabled {
  background-color: #333;
  color: #666;
  cursor: not-allowed;
}

.calendar-day.active {
  background-color: #4CAF50;
  color: white;
}

.calendar-day.today {
  background-color: #9a5eea;
  color: white;
}

.history-results {
  display: none;
  flex-direction: column;
  align-items: center;
}

.history-results.active {
  display: flex;
}

.history-board {
  display: grid;
  grid-template-rows: repeat(10, 1fr);
  gap: 4px;
  margin: 10px 0;
}

.history-row {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  gap: 4px;
}

.history-tile {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  background-color: rgba(255, 255, 255, 0.251);
  color: white;
  text-transform: uppercase;
}

.history-tile.correct {
  background-color: #4CAF50;
  color: white;
}

.history-tile.present {
  background-color: #FFC107;
  color: black;
}

.history-tile.absent {
  background-color: #888;
  color: white;
}

@media (max-width: 800px) {
  .boards-container {
    flex-direction: column;
    align-items: center;
  }
  .board-container {
    margin-bottom: 20px;
  }
  .tile {
    width: 50px;
    height: 50px;
    font-size: 18px;
  }
  .correct-word {
    width: 258px; /* 5 tiles * 50px + 4 gaps * 4px */
  }
}


.key {
  display: flex;
  justify-content: center;
  align-items: center;
  background: none; /* إزالة الخلفية الافتراضية للزر */
  border: none;
  border-radius: 8px;
  padding: 0; /* إزالة الحشوة الافتراضية */
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  min-width: 72px;
    height: 48px; /* ارتفاع ثابت للزر */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}

.key-container {
  display: flex;
  width: 100%;
  height: 100%;
}

.key-section {
  flex: 1;
  background: linear-gradient(145deg, #7b40bd, #9a5eea); /* اللون الافتراضي للقسم */
  transition: background 0.3s;
}

.key-section:first-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.key-section:last-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.key-section.correct {
  background: #4CAF50 !important; /* أخضر للحرف الصحيح */
}

.key-section.present {
  background: #FFC107 !important; /* أصفر للحرف الموجود لكن مكانه خاطئ */
}

.key-section.absent {
  background: #ffffff08 !important; /* رمادي (لون الزرار بعد التغيير) */
}

.key:hover .key-section {
  background: linear-gradient(145deg, #9a5eea, #7b40bd);
}

.key:active {
  transform: scale(0.92);
}

/* إزالة الأنماط القديمة غير الضرورية */
.key.key-absent {
  background: none !important;
}

.key.key-absent:hover {
  background: none !important;
}

.key.key-absent:hover .key-section {
  background: #6d35a83c !important;
}

/* تخصيص زر Delete و Enter */
.key-delete, .key-enter {
  background: none;
}

.key-delete .key-section {
  background: #ff5c5c !important;
}

.key-delete:hover .key-section {
  background: #e04f4f !important;
}

.key-enter .key-section {
  background: #4CAF50 !important;
}

.key-enter:hover .key-section {
  background: #45a049 !important;
}

/* النص داخل الزر */
.key-text {
  position: absolute;
  color: white;
  font-size: 20px;
  font-weight: bold;
}

.tile.converted-correct {
  background: #800080 !important; /* لون بنفسجي داكن */
  color: white !important; /* نص أبيض للتباين */
  border-color: #800080 !important;
}

.key-section.converted-correct {
  background: #800080 !important; /* نفس اللون البنفسجي للوحة المفاتيح */
}