/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    color: #333;
    direction: rtl;
    overflow-x: hidden;
}

/* فئة للعناصر المخفية بصرياً ولكن متاحة لقارئات الشاشة */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* شاشة البداية */
.start-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    text-align: center;
}

.game-title h1 {
    font-size: 3rem;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 10px rgba(255,215,0,0.5); }
    to { text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 20px rgba(255,215,0,0.8); }
}

.game-title .fa-dragon {
    color: #ffd700;
    margin-left: 15px;
}

.subtitle {
    color: #e0e0e0;
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.accessibility-options {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid rgba(255,255,255,0.2);
}

.accessibility-options h2 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.option-group {
    margin-bottom: 15px;
    text-align: right;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
}

.option-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #ffd700;
}

.option-group select {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.9);
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
}

.start-button {
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    color: #333;
    border: none;
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 15px rgba(255,215,0,0.3);
    font-family: 'Cairo', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
}

.start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 20px rgba(255,215,0,0.4);
}

.start-button:focus {
    outline: 3px solid #fff;
    outline-offset: 3px;
}

.instructions {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.2);
    max-width: 500px;
}

.instructions h3 {
    color: #fff;
    margin-bottom: 15px;
}

.instructions ul {
    list-style: none;
    text-align: right;
}

.instructions li {
    color: #e0e0e0;
    margin-bottom: 8px;
    padding-right: 20px;
    position: relative;
}

.instructions li::before {
    content: "•";
    color: #ffd700;
    position: absolute;
    right: 0;
}

/* منطقة اللعب */
.game-area {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.game-info {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
}

.player-info, .computer-info {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255,255,255,0.2);
}

.player-info h2, .computer-info h2 {
    color: #fff;
    margin-bottom: 15px;
    text-align: center;
}

.health-bar, .defense-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

.health-label, .defense-label {
    color: #e0e0e0;
    font-weight: 600;
}

.health-value {
    color: #4CAF50;
    font-weight: 700;
    font-size: 1.2rem;
}

.defense-value {
    color: #2196F3;
    font-weight: 700;
    font-size: 1.2rem;
}

.turn-indicator {
    text-align: center;
    background: rgba(255,215,0,0.2);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 15px;
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
}

/* منطقة البطاقات المُلعبة */
.played-cards-area {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
}

.player-played-card, .computer-played-card {
    text-align: center;
}

.player-played-card h3, .computer-played-card h3 {
    color: #fff;
    margin-bottom: 15px;
}

.card-slot {
    min-height: 120px;
    background: rgba(255,255,255,0.1);
    border: 2px dashed rgba(255,255,255,0.3);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.empty-slot {
    color: #ccc;
    font-style: italic;
}

.vs-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #ffd700;
    font-size: 1.5rem;
    font-weight: 700;
}

.vs-indicator i {
    font-size: 2rem;
}

/* يد اللاعب */
.player-hand {
    margin-bottom: 30px;
}

.player-hand h3 {
    color: #fff;
    margin-bottom: 15px;
    text-align: center;
}

.hand-cards {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    min-height: 150px;
}

/* تصميم البطاقات */
.card {
    width: 150px;
    height: 200px;
    background: linear-gradient(145deg, #fff, #f0f0f0);
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border: 3px solid transparent;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.card:hover, .card:focus {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    border-color: #ffd700;
    outline: none;
}

.card.selected {
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255,215,0,0.5);
}

.card.attack {
    border-right: 4px solid #f44336;
}

.card.defense {
    border-right: 4px solid #2196F3;
}

.card.special {
    border-right: 4px solid #9C27B0;
}

.card-name {
    font-weight: 700;
    font-size: 0.9rem;
    text-align: center;
    margin-bottom: 10px;
    color: #333;
}

.card-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-icon {
    font-size: 1.2rem;
}

.attack-stat .stat-icon {
    color: #f44336;
}

.defense-stat .stat-icon {
    color: #2196F3;
}

.stat-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.card-description {
    font-size: 0.8rem;
    color: #666;
    text-align: center;
    line-height: 1.3;
}

.played-card {
    background: linear-gradient(145deg, #e8f5e8, #c8e6c9);
    border: 3px solid #4CAF50;
}

/* أزرار التحكم */
.game-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.control-btn {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.3);
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Cairo', sans-serif;
}

.control-btn:hover, .control-btn:focus {
    background: rgba(255,255,255,0.2);
    border-color: #ffd700;
    transform: translateY(-2px);
    outline: none;
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* منطقة الرسائل */
.message-area {
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.game-log {
    color: #fff;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.6;
}

.game-log p {
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

/* نافذة انتهاء اللعبة */
.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: linear-gradient(145deg, #fff, #f0f0f0);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.5s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-content h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.game-result {
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 10px;
}

.game-result.victory {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.game-result.defeat {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.final-stats {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.final-stats p {
    margin-bottom: 8px;
    color: #333;
}

.play-again-btn {
    background: linear-gradient(145deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
    font-family: 'Cairo', sans-serif;
}

.play-again-btn:hover, .play-again-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(40, 167, 69, 0.3);
    outline: none;
}

/* التباين العالي */
body.high-contrast {
    background: #000;
    color: #fff;
}

body.high-contrast .card {
    background: #fff;
    color: #000;
    border: 3px solid #fff;
}

body.high-contrast .card:hover,
body.high-contrast .card:focus,
body.high-contrast .card.selected {
    border-color: #ffff00;
    background: #ffff00;
    color: #000;
}

body.high-contrast .control-btn {
    background: #fff;
    color: #000;
    border: 2px solid #fff;
}

body.high-contrast .control-btn:hover,
body.high-contrast .control-btn:focus {
    background: #ffff00;
    border-color: #ffff00;
}

/* تصميم متجاوب */
@media (max-width: 768px) {
    .game-info {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .played-cards-area {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .hand-cards {
        justify-content: center;
    }
    
    .card {
        width: 130px;
        height: 180px;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .game-title h1 {
        font-size: 2rem;
    }
}

