:root {
  --gray-10: #fcfcfb;
  --gray-900: #0b0b0b;
  --neutral-900: var(--gray-900);
  --alpha-2: hsl(from var(--neutral-900) h s l / 10%);
  --surface-1: var(--gray-10);
  --text-primary: var(--neutral-900);
  --border-strong: var(--alpha-3);
  --gray-0: #ffffff;
 
  --gray-900: #0b0b0b;
  --neutral-900: var(--gray-900);
  --alpha-3: hsl(from var(--neutral-900) h s l / 20%);
  
  --surface-2: var(--gray-0);
  --text-primary: var(--neutral-900);
  }
  
  * { box-sizing: border-box; margin: 0; padding: 0; }
  #app {
    padding: 16px 8px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-height: 100%;
    font-family: var(--font-sans, system-ui, sans-serif);
  }
  #toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 10px 14px;
    background: var(--surface-1);
    border-radius: 12px;
    border: 0.5px solid var(--alpha-2);
    width: 100%;
    max-width: 460px;
  }
  .digit-btn {
    width: 38px; height: 38px;
    border-radius: 8px;
    border: 0.5px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: 15px; font-weight: 500;
    font-family: var(--font-mono, monospace);
    cursor: pointer;
	padding:0;
    transition: transform 0.1s, border-color 0.15s;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .digit-btn:hover { transform: scale(1.08); }
  .digit-btn.active { transform: scale(1.1); border-width: 2.5px; }
  .digit-btn.erase { font-size: 17px; color: var(--text-secondary); }

 .btn {
  padding: 12px 25px;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: bold;
  font-size: 1rem;
  transition: transform 0.1s;
}

.btn:active { transform: scale(0.95); }
.btn-reset { background: #ff4757; } /* Rouge vif */
.btn-rules { background: #6366f1; } /* violet */
.btn-back { background: #1e90ff; }  /* Bleu vif */
  #grid-wrap {
    display: flex; flex-direction: column; gap: 0;
    position: relative;
  }
  .grid-row { display: flex; gap: 0; }
  .cell {
    width: 58px; height: 58px;
    border: 1px solid #4a5068;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono, monospace);
    font-size: 20px; font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, transform 0.15s;
    background: var(--surface-1);
    color: var(--text-primary);
  }
  .cell.fixed { cursor: default; font-weight: 700; font-size: 22px; }
  .cell.fixed:hover { filter: none; }
  .cell:not(.fixed):hover { filter: brightness(1.1); }

  /* ── Animation victoire ── */
  @keyframes cell-pop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.18); }
    70%  { transform: scale(0.93); }
    100% { transform: scale(1); }
  }
  @keyframes cell-shine {
    0%   { filter: brightness(1); }
    50%  { filter: brightness(1.45); }
    100% { filter: brightness(1); }
  }
  .cell.win-anim {
    animation: cell-pop 0.45s ease forwards, cell-shine 0.9s ease forwards;
  }

  /* Overlay victoire */
  #win-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 100;
    align-items: center; justify-content: center;
    backdrop-filter: blur(3px);
  }
  #win-overlay.show { display: flex; }
  #win-card {
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: 18px;
    padding: 36px 48px;
    text-align: center;
    animation: card-in 0.4s cubic-bezier(.34,1.56,.64,1) forwards;
    display: flex; flex-direction: column; gap: 18px; align-items: center;
  }
  @keyframes card-in {
    from { transform: scale(0.7) translateY(30px); opacity: 0; }
    to   { transform: scale(1) translateY(0);      opacity: 1; }
  }
  #win-card .emoji { font-size: 52px; line-height: 1; animation: spin-in 0.5s 0.2s ease both; }
  @keyframes spin-in {
    from { transform: rotate(-20deg) scale(0.5); opacity: 0; }
    to   { transform: rotate(0deg) scale(1);     opacity: 1; }
  }
  #win-card h2 { font-size: 24px; font-weight: 700; color: var(--text-primary); }
  #win-card p  { font-size: 14px; color: var(--text-secondary); }
  #win-close {
    padding: 10px 28px;
    border-radius: var(--radius);
    border: none;
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: 14px; font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-strong);
  }
  #win-close:hover { filter: brightness(1.1); }

  #status { font-size: 13px; color: var(--text-secondary); text-align: center; min-height: 18px; }
  .controls {
  margin-top: 20px;
  display: flex;
  gap: 15px;
  justify-content: center;
  }
  .action-btn {
    padding: 6px 14px;
    border-radius: var(--radius);
    border: 0.5px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 13px; cursor: pointer;
  }
  .action-btn:hover { background: var(--surface-1); }
  #sel-display { font-size: 13px; color: var(--text-secondary); min-width: 90px; }

  @keyframes confetti-fall {
    0%   { transform: translateY(-10px) rotate(0deg);   opacity: 1; }
    100% { transform: translateY(90px)  rotate(360deg); opacity: 0; }
  }
  .confetti-piece {
    position: absolute; width: 8px; height: 8px; border-radius: 2px;
    animation: confetti-fall 0.9s ease-in forwards;
    pointer-events: none;
  }
  
  .category-fillomino-fr .entry-content > :not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.is-style-wide) {
  
  max-width: 30rem;
 
}
  /* Modal */
    .modal {
        display: none;
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        animation: fadeIn 0.3s ease;
    }

    .modal.show {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .modal-content {
        background: white;
        padding: 30px;
        border-radius: 12px;
        max-width: 500px;
        width: 90%;
        max-height: 80vh;
        overflow-y: auto;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
        animation: slideUp 0.3s ease;
    }

    .modal-content h3 {
        margin-top: 0;
        color: var(--primary);
        font-size: 1.5rem;
    }

    .modal-content ul {
        line-height: 1.8;
        padding-left: 20px;
    }

    .modal-content li {
        margin-bottom: 10px;
    }

    .close-modal {
        background: #64748b;
        margin-top: 20px;
        width: 100%;
    }

    .close-modal:hover {
        background: #475569;
    }

    
    @keyframes fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

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

    @keyframes bounce {
        0%, 100% { transform: scale(1); }
        50% { transform: scale(1.1); }
    }
	/* responsive grid */
@media (max-width: 768px) {
    
	.btn {
  padding: 12px 15px;
  font-size: 0.75rem;
	}
	.controls {  
  gap: 10px;
	}
}