@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,700');

/* إعدادات عامة */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Open Sans", sans-serif;
  color: white;
  text-align: center;
  background-repeat: repeat;
  background-size: 200px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.game-board {
  height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: row;
  position: relative;
}

/* العنوان الرئيسي */
.game-board .title-h1 {
  margin: 0;
  font-weight: 400;
  color: rgba(255,255,255,.6);
  font-style: italic;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 2;
  padding: 10px;
  background: rgba(0,0,0,0.3);
}

.title-h1 h1 {
  font-size: clamp(12px, 2.5vh, 18px);
  text-align: center;
  margin: 5px 0;
  line-height: 1.2;
}

.title-h1 h1 strong {
  color: white;
  font-style: normal;
}

/* مناطق اللعب */
.hacker-area,
.player-area {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding: 60px 20px 20px 20px;
  width: 50%;
  height: 100vh;
  background-repeat: repeat;
  background-size: 200px;
}

/* شريط الإحصائيات العلوي - بالعرض */
.stats-bar {
  position: absolute;
  top: 70px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(0,0,0,0.7);
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  margin: 0 20px;
}

.stats {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 16px;
}

.hacker-area .stats {
  flex-direction: row;
}

.player-area .stats {
  flex-direction: row-reverse;
}

.life-bar {
  background: rgba(255,255,255,.4);
  width: 80px;
  height: 12px;
  position: relative;
  border: 2px solid rgba(255,255,255,0.8);
  border-radius: 6px;
}

.life-left {
  position: absolute;
  left: 0;
  top: 0;
  background: white;
  width: 50%;
  height: 100%;
  transition: width .25s ease-out;
  border-radius: 4px 0 0 4px;
}

.stats .name {
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  min-width: 50px;
}

.life-total {
  font-size: 18px;
  font-weight: 700;
  color: white;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
  background: rgba(255,255,255,0.1);
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 30px;
}

@keyframes ouch {
  0% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
  100% { transform: translateX(0); }
}

.stats.ouch {
  animation: ouch .15s linear 3;
}

/* منطقة البطاقات - منخفضة قليلاً */
.cards-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  flex: 1;
  width: 100%;
  padding: 20px;
  padding-bottom: 140px;
}

.cards-container {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.card {
  opacity: 0;
  width: 140px;
  height: 180px;
  padding: 10px 12px;
  color: black;
  font-size: 12px;
  line-height: 15px;
  font-weight: bold;
  position: relative;
  box-sizing: border-box;
  text-align: right;
  transition: all .15s ease-out;
  box-shadow: 0px 5px 10px rgba(0,0,0,.4);
  overflow: hidden;
  border-radius: 8px;
  cursor: pointer;
}

.player-area .card {
  cursor: pointer;
}

/* منطقة الصور - في الأسفل ومنفصلة يمين ويسار */
.character-area {
  position: absolute;
  bottom: 20px;
  height: 120px;
  width: 150px;
}

.hacker-area .character-area {
  left: 30px;
}

.player-area .character-area {
  right: 30px;
}

.thumbnail {
  text-align: center;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.thumbnail img {
  height: 100px;
  width: auto;
  filter: drop-shadow(0 0 8px rgba(0,0,0,0.5));
}

/* الأزرار - في المنتصف */
.buttons-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 15px;
  z-index: 5;
}

button {
  font-size: 16px;
  line-height: 16px;
  padding: 15px 25px;
  box-sizing: border-box;
  font-weight: 700;
  border: solid 3px white;
  color: white;
  background: transparent;
  border-radius: 30px;
  transition: all ease-out .2s;
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
  min-height: 50px;
}

button:hover,
button:active {
  transform: scale(1.05);
  background: rgba(255,255,255,0.1);
}

button:active {
  transform: scale(.95);
}

button.next-turn {
  display: none;
  background: black;
}

.during-game .next-turn {
  display: block;
}

button.start-game {
  background: linear-gradient(90deg, #2a79d0, #ce3d20);
  display: none;
}

.before-game .start-game {
  display: block;
}

button[disabled=true] {
  opacity: 0.5;
  transform: scale(.95);
  cursor: default;
  pointer-events: none;
}

/* تأثيرات البطاقات */
.card:after {
  content: "";
  position: absolute;
  top: 0;
  left: -20%;
  width: 140%;
  height: 0%;
  background: white;
  animation: sheen infinite .5s ease-in-out;
  display: none;
  transform: rotate(-7deg);
}

.game-board:not(.card-selected) .player-card:hover:after,
.game-board:not(.card-selected) .player-card:active:after {
  display: block;
  animation: sheen .35s linear 1;
}

@keyframes sheen {
  0% { top: -10%; height: 0%; opacity: 0; }
  25% { top: -10%; height: 20%; opacity: .2; }
  50% { top: 20%; height: 50%; opacity: .3; }
  75% { top: 110%; height: 20%; opacity: .2; }
  100% { top: 110%; height: 0%; opacity: 0; }
}

.card.prepared {
  display: block;
  opacity: 0;
}

.card.showCard {
  opacity: 1;
}

.hacker-card.showCard {
  animation: hackerShowCard .5s ease-out;
}

@keyframes hackerShowCard {
  0% { transform: translateY(-25px); opacity: .5; }
  60% { transform: translateY(5px); }
  100% { transform: translateY(0px); }
}

.player-card.showCard {
  animation: playerShowCard .5s ease-out;
}

@keyframes playerShowCard {
  0% { transform: translateY(25px); opacity: .5; }
  60% { transform: translateY(-5px); }
  100% { transform: translateY(0px); }
}

.card.tie-card {
  transform: translateY(0px) !important;
}

.card.worse-card {
  background: #888;
}

.hacker-card.better-card {
  transform: scale(1.03);
}

.hacker-card.worse-card {
  transform: scale(.90) translateY(-15px) rotate(3deg);
}

.game-board:not(.card-selected) .player-area .card:not(.played-card):hover,
.game-board:not(.card-selected) .player-area .card:not(.played-card):active {
  transform: translateY(-8px);
  box-shadow: 0px 8px 15px rgba(0,0,0,.3);
}

.player-card.played-card {
  transform: translateY(-25px);
  box-shadow: 0px 10px 15px rgba(0,0,0,.3);
}

.player-card.worse-card {
  transform: translateY(8px) rotate(3deg) !important;
  box-shadow: 0px 3px 5px rgba(0,0,0,.3);
}

.player-card.better-card {
  transform: scale(1.03) translateY(-40px);
}

/* علامات البطاقات */
.card.better-card:before,
.card.worse-card:before {
  font-size: 24px;
  position: absolute;
  bottom: 12px;
  left: 15px;
  color: rgba(0,0,0,.3);
  display: block;
}

.card.better-card:before {
  content: "\2713";
}

.card.worse-card:before {
  content: "\2717";
}

.card .power {
  font-size: 22px;
  position: absolute;
  bottom: 10px;
  line-height: 22px;
  right: 10px;
  width: 22px;
  height: 22px;
  text-align: center;
  border-radius: 50%;
  color: rgba(0,0,0,0);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.card.reveal-power .power {
  color: black;
  animation: showPower .2s ease-out;
  background: none;
}

@keyframes showPower {
  0% { background: none; transform: scaleX(1); color: rgba(0,0,0,0); }
  49% { color: rgba(0,0,0,0); transform: scaleX(0); }
  51% { background: none; color: black; transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

/* قسم الفائز */
.winner-section {
  display: none;
  position: fixed;
  padding: 20px;
  left: 0;
  right: 0;
  bottom: 0;
  align-items: center;
  justify-content: center;
  animation: winnerAppear .4s ease-out;
  z-index: 10;
}

.winner-section button {
  margin-left: 10px;
  font-size: 16px;
  padding: 15px 25px;
}

.winner-message {
  color: white;
  font-size: 18px;
  font-weight: 700;
  position: relative;
  top: 1px;
}

@keyframes winnerAppear {
  0% { transform: translateY(100px); }
  60% { transform: translateY(-5px); }
  100% { transform: translateY(0); }
}

.game-over button.next-turn,
.game-over button.start-game {
  display: none;
}

/* استعلامات الوسائط للهواتف */
@media (max-width: 768px) {
  .game-board {
    flex-direction: column;
  }
  
  .hacker-area{
    width: 100%;
    height: 40vh;
    padding: 60px 15px 15px 15px;
  }

  .player-area {
    width: 100%;
    height: 50vh;
    padding: 60px 15px 15px 15px;
  }
  
  .stats-bar {
    top: 55px;
    margin: 0 10px;
    padding: 8px 15px;
  }
  
  .stats {
    font-size: 14px;
    gap: 10px;
  }
  
  .life-bar {
    width: 60px;
    height: 10px;
  }
  
  .life-total {
    font-size: 16px;
    padding: 3px 6px;
  }
  
  .stats .name {
    font-size: 12px;
  }
  
  .card {
    width: 110px;
    height: 140px;
    font-size: 10px;
    line-height: 12px;
    padding: 8px 10px;
  }
  
  .cards-area {
    padding-bottom: 100px;
  }
  
  .character-area {
    height: 90px;
    width: 120px;
    bottom: 15px;
  }
.buttons-container {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  gap: 15px;
  z-index: 5;
}
  
  .hacker-area .character-area {
    left: 20px;
  }
  
  .player-area .character-area {
    right: 20px;
  }
  
  .thumbnail img {
    height: 80px;
  }
  
  .cards-container {
    gap: 10px;
  }
  
  .title-h1 h1 {
    font-size: clamp(10px, 3vw, 14px);
  }
  
  button {
    font-size: 14px;
    padding: 12px 20px;
    min-height: 36px;
 margin: 10 10px;
  }
}

@media (max-width: 480px) {
  .card {
    width: 95px;
    height: 120px;
    font-size: 9px;
    line-height: 11px;
    padding: 6px 8px;
  }
  
  .cards-area {
    padding-bottom: 80px;
  }
  
  .character-area {
    height: 70px;
    width: 100px;
    bottom: 10px;
  }
  
  .hacker-area .character-area {
    left: 15px;
  }
  
  .player-area .character-area {
    right: 15px;
  }
  
  .thumbnail img {
    height: 60px;
  }
  
  .life-bar {
    width: 50px;
    height: 8px;
  }
  
  .stats {
    font-size: 12px;
    gap: 8px;
  }
  
  .life-total {
    font-size: 14px;
  }
  
  .stats .name {
    font-size: 11px;
  }
}
