@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');

body {
    font-family: 'Poppins', sans-serif;
    background: #f7f9fb;
    color: #ffffff;
    text-align: center;
    padding: 20px;
}

body, h1, h2, h3, h4, p, span, label, input, button {
    color: white !important;
}

.sp-button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    max-width: 320px;
    margin: 5px auto;
}

.sp-button {
    background: none;
    border: none;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
    height: auto;
    overflow: hidden;
    cursor: pointer;
}

.sp-button img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent;
}

/* Hover */
.sp-button:hover img {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
}
.sp-button:hover {
    transform: scale(1.02);
}

/* التايمر */
#sp-timer {
    width: 30px;
    height: 30px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: conic-gradient(#00ffc3 calc(var(--value, 100) * 1%), rgba(255,255,255,0.1) 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #f5ea61;
    transition: background 0.3s ease;
    box-shadow: 0 0 0 5px #fff, 0 0 30px rgba(0, 255, 255, 0.5);
}

/* البازل */
#puzzle-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 200px;
    height: 200px;
    margin: auto;
    gap: 4px;
    background: #fff2;
    border-radius: 12px;
    border: 2px solid #ffffff44;
    padding: 6px;
}
.tile {
    background-size: 200px 200px;
    background-repeat: no-repeat;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
}
.tile:hover {
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(255,255,255,0.3);
}
.tile.empty {
    background: transparent;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: default;
}

/* الفورم */
#sp-form {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 30px;
    border-radius: 20px;
    margin: 10px auto;
    width: 240px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
#sp-form input {
    display: block;
    width: 100%;
    margin: 16px auto;
    padding: 14px 18px;
    border-radius: 12px;
    border: 1px solid #ddd;
    font-size: 16px;
    color: #000 !important;
    background: #fff;
}
#sp-form input:focus {
    border-color: #38f9d7;
    outline: none;
    box-shadow: 0 0 5px rgba(33, 150, 243, 0.4);
}
#sp-form button {
    background: linear-gradient(135deg, #1947ba, #38f9d7);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    animation: pulse 2s infinite;
}
#sp-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0, 230, 118, 0.4);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* فشل */
#sp-fail {
  display: none;
  text-align: center;
  padding: 20px;
}
#sp-fail img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
}

/* تأثير خفيف بديل confetti */
.confetti-piece {
  position: fixed;
  width: 8px;
  height: 14px;
  top: 0;
  background-color: hsl(var(--hue), 90%, 60%);
  opacity: 0.9;
  transform: rotate(0deg);
  animation: confettiFall linear forwards;
  z-index: 9999;
  pointer-events: none;
  border-radius: 2px;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(50vh) rotate(180deg);
  }
  100% {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}


/* موبايل */
@media (max-width: 600px) {
    #puzzle-board {
        width: 90vw;
        height: 90vw;
    }
    .sp-button-grid {
        grid-template-columns: 1fr 1fr;
    }
    .sp-button {
        height: 140px;
        font-size: 13px;
        padding: 10px;
    }
    .tile:hover {
        transform: none;
        box-shadow: none;
    }
    #sp-form {
        width: 60%;
        padding: 24px;
    }
    #sp-form input,
    #sp-form button {
        width: 90%;
        font-size: 18px;
    }
}
