/* Style.css - تصميم لعبة يا حريف */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  user-select: none;
}

body {
  background: #2a1a08 url('https://www.transparenttextures.com/patterns/wood-pattern.png');
  color: #fff;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  direction: rtl;
}

.game-container {
  width: 100%;
  max-width: 420px;
  background: #3a2510;
  border: 4px solid #8b5a2b;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

/* الهيدر */
.game-header {
  text-align: center;
  margin-bottom: 20px;
}

.game-title {
  font-size: 2.2rem;
  color: #f39c12;
  text-shadow: 2px 2px 4px #000;
}

.publisher {
  font-size: 0.85rem;
  color: #d2b48c;
  margin-top: -5px;
}

/* الشاشات */
.screen {
  display: none;
  flex-direction: column;
  gap: 15px;
}

.screen.active {
  display: flex;
}

/* الأزرار العامة */
.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  background: linear-gradient(145deg, #d4af37, #aa820a);
  color: #1a0f00;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.btn-primary {
  background: linear-gradient(145deg, #27ae60, #1e8449);
  color: #fff;
  font-size: 1.2rem;
}

.btn-secondary {
  background: #7f8c8d;
  color: #fff;
}

.btn-danger {
  background: #c0392b;
  color: #fff;
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* القائمة الرئيسية */
.mode-selection {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-btn {
  background: #5c3a1e;
  color: #f1c40f;
  border: 2px solid #8b5a2b;
}

.mode-btn.selected {
  background: #d4af37;
  color: #1a0f00;
  border-color: #fff;
}

.name-inputs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-group label {
  font-size: 0.9rem;
  color: #e0cda9;
}

.input-group input {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #8b5a2b;
  background: #2a1a08;
  color: #fff;
  text-align: center;
  font-size: 1rem;
}

/* شاشة اللعب */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.turn-indicator {
  font-size: 1.1rem;
  font-weight: bold;
  color: #f39c12;
}

.scoreboard {
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: #2a1a08;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #8b5a2b;
}

.score-card {
  text-align: center;
  font-size: 0.95rem;
}

.score {
  display: block;
  font-size: 1.4rem;
  font-weight: bold;
  color: #f1c40f;
}

.vs-badge {
  font-weight: bold;
  color: #e74c3c;
}

/* لوحة اللعب */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 15px 0;
}

.cell {
  aspect-ratio: 1;
  background: linear-gradient(145deg, #ffd700, #b8860b);
  border: 2px solid #5c3a1e;
  border-radius: 12px;
  font-size: 2.8rem;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: inset 0 2px 5px rgba(255,255,255,0.5), 0 4px 6px rgba(0,0,0,0.4);
}

.cell.x {
  color: #00d2ff;
  text-shadow: 0 0 10px #00d2ff, 2px 2px 4px #000;
}

.cell.o {
  color: #e74c3c;
  text-shadow: 0 0 10px #e74c3c, 2px 2px 4px #000;
}

/* إضاءة الخلايا الفائزة */
.cell.glow-x {
  background: #00d2ff !important;
  color: #fff !important;
  box-shadow: 0 0 20px #00d2ff;
}

.cell.glow-o {
  background: #e74c3c !important;
  color: #fff !important;
  box-shadow: 0 0 20px #e74c3c;
}

.round-message {
  text-align: center;
  font-size: 1.3rem;
  font-weight: bold;
  color: #2ecc71;
  min-height: 30px;
}

/* النوافذ المنبثقة (Modals) */
.modal {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: #3a2510;
  border: 3px solid #d4af37;
  padding: 25px;
  border-radius: 12px;
  text-align: center;
  width: 85%;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

.winner-box h2 {
  color: #f1c40f;
  font-size: 1.8rem;
  margin-bottom: 10px;
}

.winner-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: #fff;
}

.winner-subtitle {
  color: #d2b48c;
  margin-bottom: 10px;
}

.final-score {
  font-size: 1.1rem;
  margin: 10px 0;
  color: #2ecc71;
}