/* --- Sandwich Sudoku Specific Styles --- */

.sandwich-container {
    max-width: 950px; /* Wider container to accommodate clues */
}

#sandwich-grid-wrapper {
    display: grid;
    /* Grid layout: corner, top clues, corner, left clues, main grid, right clues, etc. */
    grid-template-columns: 40px 1fr 40px;
    grid-template-rows: 40px 1fr 40px;
    width: 100%;
    max-width: 575px;
    margin: 0 auto;
    gap: 5px;
}

.sudoku-grid {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    border: 3px solid #333;
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.theme-dark .sudoku-grid { border-color: var(--text-color-dark); }
.theme-paper .sudoku-grid { border-color: var(--text-color-paper); }

.clue-holder {
    display: grid;
    font-weight: bold;
    font-size: clamp(12px, 2.5vw, 18px);
}

.theme-light .clue-holder { color: var(--primary-color-light); }
.theme-dark .clue-holder { color: var(--primary-color-dark); }
.theme-paper .clue-holder { color: var(--primary-color-paper); }


.clue-holder.top, .clue-holder.bottom {
    grid-column: 2 / 3;
    grid-template-columns: repeat(9, 1fr);
}
.clue-holder.top { grid-row: 1 / 2; }
.clue-holder.bottom { grid-row: 3 / 4; }

.clue-holder.left, .clue-holder.right {
    grid-row: 2 / 3;
    grid-template-rows: repeat(9, 1fr);
}
.clue-holder.left { grid-column: 1 / 2; }
.clue-holder.right { grid-column: 3 / 4; }

.clue {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    min-height: 20px;
    min-width: 20px;
}
.theme-light .clue { background-color: #e8f2fe; }
.theme-dark .clue { background-color: #3a506b; }
.theme-paper .clue { background-color: #f5efd8; }


/* --- Responsive Layout --- */
@media (max-width: 768px) {
    #sandwich-grid-wrapper {
        grid-template-columns: 30px 1fr 30px;
        grid-template-rows: 30px 1fr 30px;
        max-width: 95vw;
        gap: 3px;
    }
    .clue-holder {
        font-size: clamp(10px, 2.5vw, 14px);
    }

        /* --- أضف هذا الجزء الجديد --- */
    .game-controls {
        margin-top: -30px; /* اسحب الحاوية للأعلى بمقدار 15 بكسل */
    }
}

@media (min-width: 769px) {
  .sandwich-container {
    display: grid;
    grid-template-columns: minmax(0, 650px) auto;
    gap: 25px;
    align-items: flex-start;
  }
  .difficulty-and-new-game-controls {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-left: 85px; 
  }
  #sandwich-grid-wrapper {
    grid-column: 1;
    grid-row: 2;
  }
  .game-controls {
    grid-column: 2;
    grid-row: 2;
    width: 240px;
    margin-top: 45px; 
    margin-left: -70px; 
  }
}


/* ============================================= */
/* ==  أكواد تحسين زر التلميح (Hint) - أضف هذا  == */
/* ============================================= */

/*
   تمت إضافة متغيرات الألوان للتأثير.
   هذه ستعمل مع الثيمات الموجودة في style.css الرئيسي.
*/
body.theme-light {
    --hint-glow-color: #fef08a; /* لون التوهج: أصفر فاتح */
    --hint-text-color: #4a90E2;  /* لون رقم التلميح: أزرق */
}

body.theme-dark {
    --hint-glow-color: #fde047; /* لون التوهج: أصفر ساطع */
    --hint-text-color: #5DADE2;  /* لون رقم التلميح: أزرق فاتح */
}

body.theme-paper {
    --hint-glow-color: #47f7fd; /* لون التوهج: سماوي */
    --hint-text-color: #B58900;  /* لون رقم التلميح: أصفر داكن */
}

/* --- حركة التوهج (Animation) --- */
.hint-reveal {
    animation: hint-glow 800ms ease-in-out;
}

@keyframes hint-glow {
    0% {
        background-color: var(--cell-bg-color);
        box-shadow: none;
    }
    50% {
        background-color: var(--hint-glow-color);
        box-shadow: 0 0 15px var(--hint-glow-color);
    }
    100% {
        background-color: var(--cell-bg-color);
        box-shadow: none;
    }
}

/* --- التنسيق الدائم للخلية التي تم تلميحها --- */
.cell.hint-cell .cell-value {
    color: var(--hint-text-color) !important;
    font-weight: bold;
}


/* --- تأثير الظهور الإبداعي عند الضغط على Solve --- */
.reveal-pulse {
    animation: solvePulse 0.5s ease-out;
}

/* تمييز لون الرقم الذي كشفه النظام */
.cell.reveal-pulse .cell-value {
    color: var(--hint-text-color) !important;
}

@keyframes solvePulse {
    0% {
        transform: scale(0.5);
        background-color: rgba(74, 144, 226, 0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        background-color: rgba(74, 144, 226, 0.1);
    }
    100% {
        transform: scale(1);
        background-color: transparent;
        opacity: 1;
    }
}

.clue, .clue-holder {
    user-select: none;
    -webkit-user-select: none;
    cursor: default; /* ليعرف المستخدم أنها ليست قابلة للنقر */
}