* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #ff6b9d 0%, #c94b4b 100%);
    min-height: 100vh;
    overflow-x: hidden;
    /* iPhone safe areas */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.page {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.5s ease-in;
}

.page.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

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

/* SUDOKU PAGE */
#sudoku-page h1 {
    color: white;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.8rem;
    cursor: pointer;
    user-select: none;
}

.sudoku-container {
    background: #ffe6f0;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.sudoku-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 0;
    border: 3px solid #c94b4b;
    background: #333;
    width: 380px;
    height: 580px;
    aspect-ratio: 1;
}

.sudoku-cell {
    background: white;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
}

.sudoku-cell.fixed {
    background: #f0f0f0;
    color: #333;
    cursor: default;
}

.sudoku-cell.selected {
    background: #ffc0d9;
}

.sudoku-cell:nth-child(3n):not(:nth-child(9n)) {
    border-right: 3px solid #333;
}

.sudoku-cell:nth-child(n+19):nth-child(-n+27),
.sudoku-cell:nth-child(n+46):nth-child(-n+54) {
    border-bottom: 3px solid #333;
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 20px;
    max-width: 410px;
}

.number-btn {
    background: #e63946;
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: manipulation;
}

.number-btn:active {
    transform: scale(0.95);
}

.check-btn {
    grid-column: 1 / -1;
    background: #ff69b4;
    margin-top: 10px;
}

/* MESSAGE PAGE */
#message-page {
    text-align: center;
    padding: 40px 20px;
}

#message-page h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#message-page p {
    color: white;
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 30px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.continue-btn {
    background: white;
    color: #e63946;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    touch-action: manipulation;
}

.continue-btn:active {
    transform: scale(0.95);
}

/* SLIDESHOW PAGE */
#slideshow-page {
    padding: 0;
    background: black;
}

.slideshow-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.slide {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.slide.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: slideIn 0.5s ease-out;
}

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

.slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.slide-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.nav-buttons {
    position: absolute;
    bottom: 80px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
}

.nav-btn {
    background: rgba(255,255,255,0.9);
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 1.5rem;
    cursor: pointer;
    touch-action: manipulation;
}

.audio-control {
    position: absolute;
    top: 40px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    z-index: 10;
}

.photo-caption {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 1rem;
    font-style: italic;
    text-align: center;
    max-width: 80%;
}