:root {
    --primary-color: #008b7d;
    --primary-dark: #004d40;
    --accent-color: #1abc9c;
    --success-color: #27ae60;
    --fail-color: #e74c3c;
    --skip-color: #f39c12;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    --font-heading: 'Cairo', sans-serif;
}

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

body {
    font-family: var(--font-heading);
    background: linear-gradient(135deg, #008b7d 0%, #004d40 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: 20px;
    left: 20px;
    width: auto;
    padding: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    background: transparent;
    pointer-events: none;
}

.global-scores>* {
    pointer-events: auto;
    /* إعادة تفعيل النقر للعناصر الداخلية مثل الشعار */
}

.nav-logo {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    pointer-events: auto;
    transition: transform 0.3s ease;
}

.nav-logo:hover {
    transform: scale(1.02);
}

.nav-logo img {
    height: 200px;
    /* تصغير طفيف لتحسين المظهر الجانبي */
    width: auto;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

.scores {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.nav-spacer {
    display: none;
}

@media (max-width: 768px) {
    .nav-spacer {
        display: none;
    }
}

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

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

.container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 3rem;
    box-shadow: var(--card-shadow);
    max-width: 1100px;
    width: 90%;
    animation: slideIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@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, #008b7d 0%, #004d40 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: 1.2rem;
    margin-bottom: 2rem;
}

input[type="text"] {
    flex: 1;
    padding: 1.2rem 1.8rem;
    border: 2px solid rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    font-size: 1.15rem;
    font-family: var(--font-heading);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

input[type="text"]:focus {
    outline: none;
    background: white;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(26, 188, 156, 0.15);
}

.btn {
    padding: 1rem 2.2rem;
    border: none;
    border-radius: 18px;
    font-size: 1.15rem;
    font-weight: 800;
    font-family: var(--font-heading);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-transform: none;
    letter-spacing: normal;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover:not(:disabled)::after {
    opacity: 1;
}

.btn:active:not(:disabled) {
    transform: scale(0.96);
}

.btn-add {
    background: linear-gradient(135deg, #008b7d 0%, #004d40 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 77, 64, 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(5, 1fr);
    gap: 1.2rem;
    margin: 2rem 0;
}

.challenge-option {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.challenge-option:hover {
    transform: translateY(-8px) scale(1.03);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.challenge-option.selected {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 10px 25px rgba(0, 139, 125, 0.4);
}

.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: #006d5b;
    font-weight: 900;
}

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

.score-item {
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.8rem 1.2rem;
    border-radius: 20px;
    font-weight: 700;
    color: #1a1a1a;
    width: fit-content;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.score-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.85);
}

/* إبراز اللاعب المختار */
.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 4rem;
    font-size: 1.8rem;
    font-weight: 900;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%, #fbc2eb 100%);
    color: white;
    border: none;
    border-radius: 60px;
    cursor: pointer;
    box-shadow: 0 15px 35px rgba(245, 87, 108, 0.4);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: var(--font-heading);
    text-transform: none;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.spin-button:hover:not(:disabled) {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 20px 45px rgba(245, 87, 108, 0.6);
    filter: brightness(1.1);
}

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

/* منطقة التحدي */
/* منطقة التحدي - إعادة تصميم احترافية */
.challenge-area {
    margin-top: 2rem;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.challenge-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 40px;
    padding: 3rem 2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    text-align: center;
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.challenge-card:hover {
    transform: translateY(-5px);
}

.challenge-title {
    font-size: 2.8rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.challenge-content {
    font-size: 1.6rem;
    color: #2d3436;
    margin-bottom: 2.5rem;
    line-height: 1.5;
    font-weight: 600;
    min-height: 80px;
}

/* أزرار التصويت والتحكم */
.voting-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    width: 100%;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.secondary-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: center;
    gap: 1rem;
    width: 100%;
    flex-wrap: wrap;
}

.challenge-btn {
    padding: 1.2rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    min-width: 140px;
}

.btn-vote-success {
    background: linear-gradient(135deg, #00b894 0%, #55efc4 100%);
    color: white;
    box-shadow: 0 8px 15px rgba(0, 184, 148, 0.3);
}

.btn-vote-success:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 184, 148, 0.4);
}

.btn-vote-fail {
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    color: white;
    box-shadow: 0 8px 15px rgba(214, 48, 49, 0.3);
}

.btn-vote-fail:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 25px rgba(214, 48, 49, 0.4);
}

.btn-control-skip {
    background: linear-gradient(135deg, #fab1a0 0%, #e17055 100%);
    color: white;
    width: 100%;
    box-shadow: 0 6px 15px rgba(225, 112, 85, 0.3);
}

/* ستايل التوقيت الاحترافي */
.timer-container {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 25px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#timer {
    font-size: 4.5rem;
    font-weight: 900;
    color: #d63031;
    font-family: 'Cairo', sans-serif;
    line-height: 1;
    text-shadow: 0 4px 10px rgba(214, 48, 49, 0.2);
}

/* شاشة الاحتفال */
.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(3, 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;
    }
}

/* أزرار تعديل النقاط */
.score-controls {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-right: 12px;
}

.point-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-plus {
    background: var(--success-color);
}

.btn-minus {
    background: var(--fail-color);
}

.point-btn:hover {
    transform: scale(1.15);
    filter: brightness(1.1);
}

.skip-btn {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(230, 126, 34, 0.3);
}

.skip-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(230, 126, 34, 0.45);
}

/* أزرار التحكم السفلية */
.bottom-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
}

.bottom-control-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: #333;
    pointer-events: auto;
}

.bottom-control-btn:hover {
    transform: translateY(-5px);
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.settings-link {
    width: 50px;
    height: 50px;
    padding: 0;
    font-size: 1.6rem;
    border-radius: 50%;
}

/* مؤشرات الجولات */
.round-badge {
    background: white;
    border: 1px solid rgba(0, 109, 91, 0.2);
    border-radius: 15px;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin: 0 auto 1.5rem;
    width: fit-content;
    animation: fadeInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.round-number {
    font-size: 1.2rem;
    font-weight: 900;
    color: #008b7d;
    background: rgba(0, 139, 125, 0.1);
    padding: 4px 12px;
    border-radius: 10px;
}

.round-count {
    font-size: 0.9rem;
    font-weight: 700;
    color: #666;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

/* شاشة انتهاء الجولة */
.screen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.round-complete-card {
    background: white;
    border-radius: 40px;
    padding: 3rem;
    max-width: 600px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: zoomIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.round-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.round-complete-card h2 {
    font-size: 2.5rem;
    color: #008b7d;
    margin-bottom: 2rem;
    font-weight: 900;
}

.round-summary {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 20px;
    margin-bottom: 2.5rem;
    text-align: right;
}

.round-summary p {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
    color: #333;
    display: flex;
    justify-content: space-between;
}

.round-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}