body {
    background-color: rgba(0, 0, 0, 0.5); /* خلفية شفافة */
    backdrop-filter: blur(3px); /* بلور داخلي خفيف */
        color: white;
    font-family: 'Cairo', sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    min-height: 100vh;
    padding: 20px;
    padding-top: 100px; /* تعويض ارتفاع الناف بار */

  }
  
  h1 {
    color: gold;
    margin-bottom: 20px;
  }
  
  .board {
    display: grid;
    grid-template-rows: repeat(6, 1fr);
    gap: 10px;
    margin-bottom: 20px;
  }
  
  .row {
    display: grid;
    grid-template-columns: repeat(5, 60px);
    gap: 10px;
  }
  
  .tile {
    border-radius: 8px;
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    transition: border 0.2s;
      display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.251);
    color: rgb(255, 255, 255);
    text-transform: uppercase;
  }

  .tile.filled {
    border-color: #a621ff;
  }
  
  .correct {
    background-color: gold;
    color: black;
    border: none;
  }
  
  .present {
    background-color: #c79bf2;
    color: black;
    border: none;
  }
  
  .absent {
    background-color: #555;
    color: white;
    border: none;
  }
  
  .keyboard {
    display: grid;
    grid-template-columns: repeat(11, 1fr);
    gap: 5px;
    max-width: 700px;
  }
  
  .key {
    padding: 10px;
    background-color: #444;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    border-radius: 5px;
  }
  
  .key:hover {
    background-color: #666;
  }
  
  .message {
    margin-top: 10px;
    font-size: 20px;
    color: gold;
  }

  
  .keyboard {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 20px;
  }
  
  .keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
  }
  
  .key {
    background-color: #512284;
    color: white;
    padding: 12px 14px;
    font-size: 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    min-width: 40px;
    text-align: center;
    transition: background-color 0.2s;
  }
  
  .key:hover {
    background-color: #6c35a8;
  }
  
  .key.control {
    background-color: gold;
    color: black;
    font-weight: bold;
    min-width: 70px;
  }
  
  .key.control:hover {
    background-color: #ffdf70;
  }
  

  /* زر التحكم العام (بيشمل إدخال ومسح، لكن هيكون مخصص لاحقًا) */
.key.control {
    font-weight: bold;
    min-width: 70px;
  }
  
  /* زر "إدخال" تحديدًا */
  .key.control.enter {
    background-color: gold;
    color: black;
    border: none;
  }
  
  .key.control.enter:hover {
    background-color: #ffdf70;
  }
  
  /* زر "مسح" تحديدًا */
  .key.control.delete {
    background-color: transparent;
    color: gold;
    border: 2px solid gold;
  }
  
  .key.control.delete:hover {
    background-color: rgba(255, 215, 0, 0.1); /* لمسة خفيفة عند التحويم */
  }
  

  .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;
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  html, body {
    height: 100%;
    overflow: hidden; /* يمنع السكروول */
    font-family: 'Arial', sans-serif;
    background-color: #1c0f2f; /* بنفسجي غامق */
    color: white;
    overflow-x: hidden;
overflow-y: auto;

  }
  


  .modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
  }
  .modal {
    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);
  }
  
  
  
  .modal-content {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    color: white;
  }
  
  #statsGrid {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 10px auto;
  }
  
  .stats-row {
    display: flex;
    justify-content: center;
    gap: 5px;
  }
  
  .stats-tile {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    border: 1px solid #ccc;
  }
  
  .stats-tile.correct {
    background-color: #4CAF50;
  }
  
  .stats-tile.present {
    background-color: #FFC107;
  }
  
  .stats-tile.absent {
    background-color: #eee;
  }
  

  .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;
  }
  


  .key.control.delete {
    background-color: transparent;
    border: 2px solid gold;
    color: gold;
    font-weight: bold;
  }
  
  .key.control.delete:hover {
    background-color: rgba(255, 215, 0, 0.1);
  }
  

  .tile.incomplete {
    border: 2px solid red !important;

  }
  

  .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;
    padding: 0;
    margin: 0;
  }
  
  .nav-logo {
    position: relative;
  }
  
  .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);
  }
  
  

  

  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;
    filter: blur(32px);
    z-index: -1; /* خلف كل العناصر */
  }
  

  /* تنسيق الشريط العادي */
::-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;
  transition: background 0.3s ease;
}

/* عند التحويم: عكس التدرج */
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to top, #a621ff, #6b3fc5);
}



.tile {
  width: 60px;
  height: 60px;
  /*perspective: 600px;*/
}

/*.tile-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s;
}*/

/*.tile.correct .tile-inner,
.tile.present .tile-inner,
.tile.absent .tile-inner {
  transform: rotateY(180deg);
}

.tile-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  text-transform: uppercase;
  backface-visibility: hidden;
  /*background-color: rgba(255, 255, 255, 0.25);
  color: white;
  border: 2px solid transparent;
}
*/
/* وجه أمامي */
.tile-face.front {
  transform: rotateY(0deg);
}

/* ظهر */
.tile-face.back {
  transform: rotateY(180deg);
}

/* ألوان الوجه الخلفي بعد التلوين */
.tile.correct .back {
  background-color: gold;
  color: black;
}

.tile.present .back {
  background-color: #c79bf2;
  color: black;
}

.tile.absent .back {
  background-color: #555;
  color: white;
}

.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;
}


@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.8); }
  to { opacity: 1; transform: translateX(-50%) scale(1); }
}



@keyframes drop {
  to {
    transform: translateY(100vh) rotateZ(360deg);
    opacity: 0;
  }
}




.key {
  min-width: 45px;
  font-weight: bold;
}


.key-enter {
  background-color: #4CAF50;
  color: white;
  font-weight: bold;
  min-width: 50px;
}

.key-enter:hover {
  background-color: #45a049;
}

.key-delete {
  background-color: transparent;
  border: 2px solid #f55;
  color: #f55;
  font-weight: bold;
  min-width: 50px;
}

.key-delete:hover {
  background-color: rgba(255, 85, 85, 0.1);
}



.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 8px;
}

.key {
  display: flex; /* تحويل الزر إلى حاوية فليكس */
  justify-content: center; /* توسيط النص أفقيًا */
  align-items: center; /* توسيط النص عموديًا */
  color: white;
  border: none;
  border-radius: 12px;
  padding: 14px 32px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  min-width: 45px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s, background 0.3s;
}
/*
.key:hover {
  background: linear-gradient(145deg, #7b40bd, #9a5eea);
}
*/
.key:active {
  transform: scale(0.92);
}

/* زر المسح */
.key-delete {
  background: none;
  border: 2px solid #ff5c5c;
  color: #ff5c5c;
  font-weight: bold;
  border-radius: 12px;
}

.key-delete:hover {
  background-color: rgba(255, 92, 92, 0.1);
}

/* زر الإدخال */
.key-enter {
  background: linear-gradient(145deg, #4CAF50, #45a049);
  color: white;
  font-weight: bold;
  border-radius: 12px;
}

.key-enter:hover {
  background: linear-gradient(145deg, #45a049, #66bb6a);
}


.key-enter {
  background: linear-gradient(145deg, #4CAF50, #45a049);
  color: white;
  font-weight: bold;
  border-radius: 12px;
  min-width: 50px;
  padding: 14px 24px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s, background 0.3s;
}

.key-enter:hover {
  background: linear-gradient(145deg, #45a049, #66bb6a);
}

.key-enter:active {
  transform: scale(0.92);
}



.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);
  }
}


#splashScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
  /*animation: splashOut 1s ease 2.2s forwards;*/
  transform: scale(1);
  opacity: 1;
}

#splashScreen::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background-image: url('img/bg.png');
  background-size: cover;
  background-position: center;
  filter: blur(32px);
  z-index: -1;
}




.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: white;
  background-color: rgba(0, 0, 0, 0.4);
  padding: 30px;
  border-radius: 16px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.4);
}


.splash-logo {
  width: 200px;
  max-width: 80vw;
  height: auto;
  margin-bottom: 20px;
  animation: popIn 1s ease;
}


.splash-text {
  font-size: 22px;
  font-weight: bold;
  margin-bottom: 10px;
  animation: blink 1s infinite;
}


@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes splashOut {
  to {
    transform: scale(0.95);
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes popIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.loader {
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top: 4px solid white;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
  margin-top: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* الحالة الطبيعية */
#splashScreen {
  transition: opacity 1s ease, transform 1s ease;
}

/* عند الإخفاء */
.splash-hide {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  visibility: hidden;
}


.hidden-before-load {
  visibility: hidden;
}

#splashScreen {
  display: none !important;
}

/* أنماط أزرار لوحة المفاتيح بناءً على حالة الحرف */
.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.key-correct {
  background: #4CAF50 !important; /* أخضر */
  color: white !important;
  box-shadow: none !important;
}




/* التأكد من أن أزرار التحكم (إدخال ومسح) لا تتأثر */
.key-enter {
 /* background: linear-gradient(180deg, #512284, #512284) !important;*/
 background: transparent;
  color: #71da74 !important;
  padding: 14px 40px;
  border: 2px solid #71da74 !important; /* إضافة بوردر أبيض */
}

.key-enter:hover {
  background: rgba(29, 211, 50, 0.1) !important;
}

.key-delete {
  background: none !important;
  border: 2px solid #ff5c5c !important;
  color: #ff5c5c !important;
  padding: 14px 40px;

}
.key-delete:hover {
  background: rgba(255, 92, 92, 0.1) !important;
}