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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: -webkit-fill-available;
    position: relative;
}

.viewfinder {
    flex: 1;
    width: 100%;
    height: 100%;
    background: #111;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#canvasOutput {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
}

#status {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 20;
    white-space: nowrap;
}

/* Grille interactive */
#sudoku-grid-container {
    position: absolute;
    width: 92vw;
    height: 92vw;
    max-width: 400px;
    max-height: 400px;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid #000;
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    border-radius: 8px;
    overflow: hidden;
    z-index: 15;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.sudoku-cell {
    border: 1px solid #ccc;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    border-radius: 0;
}

/* Différenciation visuelle */
.sudoku-cell.original-digit {
    color: #000000; /* Chiffres initiaux en noir profond */
    background-color: rgba(0, 0, 0, 0.03);
}

.sudoku-cell.solved-digit {
    color: #007aff; /* Chiffres résolus en bleu iPhone */
    background-color: rgba(0, 122, 255, 0.05);
    font-style: italic;
}

/* Bordures des blocs 3x3 */
.sudoku-cell:nth-child(3n) { border-right: 2px solid #000; }
.sudoku-cell:nth-child(9n) { border-right: none; }
.sudoku-cell:nth-of-type(n+19):nth-of-type(-n+27),
.sudoku-cell:nth-of-type(n+46):nth-of-type(-n+54) { border-bottom: 2px solid #000; }

.sudoku-cell:focus {
    background-color: #e3f2fd;
    outline: none;
}

/* Style des boutons */
.controls {
    height: 110px;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 0;
    width: 100%;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
}

#solve-btn, #confirm-btn {
    color: white;
    border: none;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 28px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#solve-btn { background-color: #34c759; }
#confirm-btn { background-color: #007aff; }
