/* ============================================================
   style.css – التصميم الكامل للعبة
   ============================================================ */

/* ---------- المتغيرات الأساسية ---------- */
:root {
    --primary: #f57c00;
    /* برتقالي Garena */
    --primary-dark: #e65100;
    --gold: #ffd54f;
    --gold-dark: #f9a825;
    --black: #1a1a1a;
    --black-light: #2a2a2a;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --neon-glow: 0 0 20px rgba(245, 124, 0, 0.6);
    --shadow-heavy: 0 20px 60px rgba(0, 0, 0, 0.8);
    --radius: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Cairo', sans-serif;
}

/* ---------- إعادة تعيين عامة ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background: radial-gradient(circle at 20% 30%, #1f1f1f, #0b0b0b);
    min-height: 100vh;
    min-height: 100dvh;
    color: #f0f0f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 12px 40px;
    overflow-x: hidden;
    position: relative;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ---------- الخلفية المتحركة (توهج) ---------- */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 40%, rgba(245, 124, 0, 0.03), transparent 60%),
        radial-gradient(circle at 70% 80%, rgba(255, 213, 79, 0.02), transparent 50%);
    pointer-events: none;
    z-index: 0;
    animation: ambientGlow 20s infinite alternate;
}

@keyframes ambientGlow {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(5%, 5%) scale(1.1);
    }
}

/* ---------- الهيدر ---------- */
.game-header {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 720px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 16px 20px 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-heavy), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
}

.logo-wrapper {
    flex-shrink: 0;
}

.logo {
    display: block;
    height: 40px;
    width: auto;
    max-width: 120px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

.game-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 20px rgba(255, 213, 79, 0.3);
    letter-spacing: 0.5px;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

.stats {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.gem-counter {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px 4px 8px;
    border-radius: 40px;
    border: 1px solid var(--gold-dark);
    font-weight: 700;
    font-size: 1.1rem;
}

.gem-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.gem-count {
    color: var(--gold);
    min-width: 1.8rem;
    text-align: center;
    transition: all 0.15s;
}

.hearts {
    display: flex;
    gap: 2px;
    font-size: 1.4rem;
    letter-spacing: 2px;
}

.heart {
    transition: all 0.3s;
    opacity: 1;
}

.heart.lost {
    opacity: 0.2;
    transform: scale(0.7);
    filter: grayscale(1);
}

/* ---------- Progress Bar ---------- */
.progress-wrapper {
    margin-top: 12px;
    position: relative;
    padding: 0 4px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.4);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), var(--gold));
    border-radius: 40px;
    transition: width 0.5s ease-out;
    box-shadow: 0 0 12px rgba(245, 124, 0, 0.3);
}

.progress-fill.glow {
    box-shadow: 0 0 30px rgba(255, 213, 79, 0.8);
    animation: pulseGlow 1s infinite alternate;
}

.progress-fill.golden {
    background: linear-gradient(90deg, var(--gold-dark), #ffecb3, var(--gold-dark));
    box-shadow: 0 0 40px rgba(255, 213, 79, 0.9);
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 20px rgba(255, 213, 79, 0.4);
    }

    100% {
        box-shadow: 0 0 60px rgba(255, 213, 79, 0.9);
    }
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #aaa;
    margin-top: 4px;
    padding: 0 4px;
}

.progress-status {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    margin-top: 2px;
    min-height: 1.6rem;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(255, 213, 79, 0.2);
}

/* ---------- شبكة اللعب ---------- */
.game-main {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-width: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--radius);
    padding: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-heavy), inset 0 0 60px rgba(245, 124, 0, 0.05);
}

/* بطاقات الخانات */
.grid-cell {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
    position: relative;
    aspect-ratio: 1 / 1;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

.grid-cell:active {
    transform: scale(0.94);
}

.grid-cell .cell-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: inherit;
    line-height: 1;
    transition: all 0.2s;
}

/* تأثيرات الجواهر والقنابل */
.grid-cell .gem-img,
.grid-cell .bomb-img {
    width: 65%;
    height: 65%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
    transition: transform 0.2s;
    pointer-events: none;
}

.grid-cell .gem-img {
    animation: gemFloat 2s ease-in-out infinite;
}

@keyframes gemFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

.grid-cell .bomb-img {
    animation: bombWobble 1.5s ease-in-out infinite;
}

@keyframes bombWobble {

    0%,
    100% {
        transform: rotate(-3deg) scale(1);
    }

    50% {
        transform: rotate(3deg) scale(1.05);
    }
}

/* ---------- زر السحب ---------- */
.withdraw-wrapper {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.btn-withdraw {
    width: 100%;
    padding: 18px 12px;
    font-size: 1.2rem;
    font-weight: 700;
    background: #444;
    color: #888;
    border: none;
    border-radius: 60px;
    cursor: not-allowed;
    transition: all var(--transition);
    letter-spacing: 1px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
}

.btn-withdraw:enabled {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #1a1a1a;
    cursor: pointer;
    box-shadow: 0 4px 30px rgba(255, 213, 79, 0.4);
}

.btn-withdraw:enabled:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 50px rgba(255, 213, 79, 0.6);
}

.btn-withdraw:enabled:active {
    transform: scale(0.96);
}

.btn-withdraw.pulse {
    animation: btnPulse 1.5s infinite;
}

@keyframes btnPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 213, 79, 0.5);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(255, 213, 79, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 213, 79, 0);
    }
}

.withdraw-hint {
    font-size: 0.85rem;
    color: #aaa;
    text-align: center;
    min-height: 1.6rem;
}

/* ---------- Modal عام ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal {
    background: linear-gradient(145deg, #1e1e1e, #0f0f0f);
    border-radius: var(--radius);
    max-width: 480px;
    width: 100%;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-heavy), 0 0 60px rgba(245, 124, 0, 0.15);
    overflow: hidden;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content {
    padding: 28px 24px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.modal-image {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.modal-image img {
    width: 100%;
    height: auto;
    display: block;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(255, 213, 79, 0.2);
}

.modal-step {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.modal-step.hidden {
    display: none;
}

.input-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.9rem;
    color: #ccc;
    font-weight: 500;
}

.input-group input {
    padding: 14px 16px;
    border-radius: 60px;
    border: 1px solid #444;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border var(--transition);
    width: 100%;
}

.input-group input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(255, 213, 79, 0.15);
}

.btn-modal {
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 60px;
    color: #fff;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 20px rgba(245, 124, 0, 0.3);
}

.btn-modal:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 40px rgba(245, 124, 0, 0.5);
}

.btn-modal:active {
    transform: scale(0.96);
}

/* ---------- تحقق وهمي ---------- */
.verification-progress {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.verification-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    overflow: hidden;
}

.verification-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 40px;
    transition: width 0.3s linear;
}

.verification-status {
    font-size: 1rem;
    color: var(--gold);
    text-align: center;
    min-height: 2rem;
}

/* ---------- استلام الجواهر (Claim) ---------- */
.claim-message {
    font-size: 1.2rem;
    color: #ddd;
}

.btn-claim {
    padding: 16px 40px;
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold-dark), #ffecb3);
    border: none;
    border-radius: 60px;
    color: #1a1a1a;
    cursor: pointer;
    box-shadow: 0 4px 40px rgba(255, 213, 79, 0.4);
    transition: all var(--transition);
}

.btn-claim:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 60px rgba(255, 213, 79, 0.7);
}

/* ---------- Content Locker container ---------- */
#contentLockerContainer {
    width: 100%;
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

/* ---------- Game Over Modal ---------- */
.modal-gameover .modal-content {
    gap: 12px;
}

.gameover-icon {
    font-size: 4rem;
}

.gameover-gems {
    font-size: 1.2rem;
    color: #ccc;
}

.gameover-gems strong {
    color: var(--gold);
    font-size: 1.6rem;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 14px 28px;
    border-radius: 60px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-weight: 500;
    box-shadow: var(--shadow-heavy);
    z-index: 1000;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.toast-icon {
    font-size: 1.4rem;
}

/* ---------- Confetti Canvas ---------- */
#confettiCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 900;
}

/* ---------- Particle Effects (تطير الجوهرة) ---------- */
.flying-gem {
    position: fixed;
    pointer-events: none;
    z-index: 100;
    font-size: 2.5rem;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

/* ---------- اهتزاز الشاشة ---------- */
@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10% {
        transform: translateX(-12px) rotate(-1deg);
    }

    30% {
        transform: translateX(12px) rotate(1deg);
    }

    50% {
        transform: translateX(-8px);
    }

    70% {
        transform: translateX(8px);
    }

    90% {
        transform: translateX(-4px);
    }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ---------- انفجار (بسيط) ---------- */
.explosion-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 80, 0, 0.8), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: explode 0.6s ease-out forwards;
}

@keyframes explode {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* ---------- استجابة (Responsive) ---------- */
@media (max-width: 480px) {
    .game-title {
        font-size: 0.9rem;
    }

    .gem-counter {
        font-size: 0.9rem;
        padding: 2px 10px 2px 6px;
    }

    .hearts {
        font-size: 1.2rem;
    }

    .game-grid {
        gap: 8px;
        padding: 8px;
    }

    .grid-cell {
        font-size: 2.8rem;
    }

    .modal-content {
        padding: 20px 16px 24px;
    }

    .modal-title {
        font-size: 1.4rem;
    }

    .btn-withdraw {
        font-size: 1rem;
        padding: 14px 12px;
    }

    .toast {
        padding: 12px 20px;
        font-size: 0.9rem;
        bottom: 20px;
    }
}

@media (min-width: 600px) {
    .game-grid {
        max-width: 500px;
    }
}

/* ---------- أدوات مساعدة ---------- */
.hidden {
    display: none !important;
}


input,
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}