* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.global-scores {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
}

.screen {
    display: none;
    min-height: 100vh;
    padding: 5rem 2rem 2rem 2rem;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 3rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    backdrop-filter: blur(10px);
    animation: slideIn 0.6s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.game-title {
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    text-align: center;
    color: #555;
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.players-input-section {
    margin-top: 2rem;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

input[type="text"] {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-size: 1.1rem;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-add {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-add:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.6);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #a8a8a8 0%, #7f7f7f 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(127, 127, 127, 0.4);
    width: auto;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(127, 127, 127, 0.6);
}

/* شاشة اختيار التحدي */
.challenges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.challenge-option {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
    min-height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.challenge-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.challenge-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.challenge-option.selected .challenge-icon {
    transform: scale(1.2);
}

.challenge-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.challenge-option h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.challenge-option p {
    font-size: 1rem;
    opacity: 0.8;
}

.challenge-option.selected p {
    opacity: 1;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.action-buttons .btn {
    flex: 1;
    max-width: 250px;
}

.players-list {
    min-height: 100px;
    margin-bottom: 2rem;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    margin-bottom: 0.8rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.player-item span {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.remove-player {
    background: #ff4757;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-weight: 600;
    transition: all 0.3s ease;
}

.remove-player:hover {
    background: #ff3838;
    transform: scale(1.05);
}

/* شاشة اللعبة */
.game-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.game-header {
    text-align: center;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.current-player {
    font-size: 2rem;
    color: #333;
    margin-bottom: 1rem;
}

.current-player span {
    color: #667eea;
    font-weight: 900;
}

.scores {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.score-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 0.8rem 1.5rem;
    border-radius: 15px;
    font-weight: 600;
    color: #333;
}

/* إبراز اللاعب المختار */
.score-item.active-player {
    transform: scale(1.08);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    border: 2px solid #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* العجلة */
.wheel-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2rem auto;
}

.wheel-pointer {
    font-size: 3rem;
    color: #ff4757;
    position: absolute;
    top: -20px;
    z-index: 10;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

#wheelCanvas {
    border-radius: 50%;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    background: white;
}

.spin-button {
    margin-top: 2rem;
    padding: 1.5rem 3rem;
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.4);
    transition: all 0.3s ease;
    font-family: 'Cairo', sans-serif;
    text-transform: uppercase;
}

.spin-button:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 40px rgba(245, 87, 108, 0.6);
}

.spin-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* منطقة التحدي */
.challenge-area {
    margin-top: 2rem;
    animation: slideUp 0.5s ease-out;
}

.challenge-area.hidden {
    display: none;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.challenge-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 3rem;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.challenge-title {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 2rem;
    font-weight: 900;
}

.challenge-content {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 2rem;
    line-height: 1.8;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.challenge-input {
    width: 100%;
    padding: 1rem;
    font-size: 1.3rem;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-family: 'Cairo', sans-serif;
    text-align: center;
    margin-top: 1rem;
}

.challenge-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.challenge-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.challenge-btn {
    padding: 1rem 2.5rem;
    font-size: 1.2rem;
    font-weight: 700;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
}

.btn-success {
    background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(86, 171, 47, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(86, 171, 47, 0.6);
}

.btn-fail {
    background: linear-gradient(135deg, #ff4757 0%, #ff6348 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

.btn-fail:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 71, 87, 0.6);
}

/* شاشة الاحتفال */
.celebration-screen {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.celebration-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 10;
}

.celebration-title {
    font-size: 4rem;
    font-weight: 900;
    margin-bottom: 1rem;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.winner-name {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.celebration-message {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.trophy {
    font-size: 8rem;
    margin: 2rem 0;
    animation: rotate 2s ease-in-out infinite;
}

@keyframes rotate {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

/* الكونفيتي */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f0f;
    animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* تصميم متجاوب للجوال (iPhone وغيره) */
@media (max-width: 768px) {
    .global-scores {
        overflow-x: auto;
        white-space: nowrap;
        padding: 0.5rem;
        -webkit-overflow-scrolling: touch;
    }

    .scores {
        display: inline-flex;
        gap: 1rem;
        padding-bottom: 5px;
    }

    .score-item {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }

    .screen {
        padding: 6rem 1rem 1rem 1rem;
    }

    .container {
        padding: 1.5rem;
        width: 95%;
    }

    .game-title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .challenges-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .challenge-option {
        padding: 1rem;
    }

    .challenge-icon {
        font-size: 2.5rem;
    }

    .challenge-option h3 {
        font-size: 1rem;
    }

    .challenge-option p {
        font-size: 0.8rem;
    }

    #wheelCanvas {
        width: 280px !important;
        height: 280px !important;
    }

    .wheel-pointer {
        font-size: 2.5rem;
        top: -15px;
    }

    .spin-button {
        padding: 1rem 2.5rem;
        font-size: 1.2rem;
    }

    .challenge-card {
        padding: 1.5rem;
    }

    .challenge-title {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .challenge-content {
        font-size: 1.2rem;
    }

    .challenge-content p {
        font-size: 1.3rem !important;
    }

    .challenge-actions {
        flex-direction: column;
        width: 100%;
    }

    .challenge-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* شاشات صغيرة جداً */
@media (max-width: 380px) {
    .challenges-grid {
        grid-template-columns: 1fr;
    }

    #wheelCanvas {
        width: 250px !important;
        height: 250px !important;
    }
}