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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1500;
}

.start-screen.hidden {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.start-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    padding: 28px 24px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.start-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.start-panel h2 {
    font-size: 1.4rem;
    color: #2C3E50;
    font-weight: 600;
}

.start-description {
    color: #5D6D7E;
    font-size: 0.95rem;
    line-height: 1.4;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #34495E;
    font-size: 0.95rem;
}

.slider-value {
    font-size: 0.85rem;
    color: #1ABC9C;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: #dfe6e9;
    border-radius: 4px;
    outline: none;
    transition: background 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6bffba, #4ECDC4);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg,  #6bffba, #4ECDC4);
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.primary-button {
    background: linear-gradient(135deg,  #6bffba, #4ECDC4);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-button:hover {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 8px 20px rgba(78, 205, 196, 0.35);
}

.primary-button:active {
    transform: scale(0.97);
}

.secondary-button {
    background: white;
    color: #03759f;
    border: 2px solid rgba(3, 117, 159, 0.2);
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
}

.secondary-button:hover {
    transform: translateY(-1px) scale(1.02);
    border-color: rgba(3, 117, 159, 0.4);
    box-shadow: 0 8px 20px rgba(3, 117, 159, 0.15);
}

.secondary-button:active {
    transform: scale(0.97);
}

.game-container {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 100vh;
}

.game-header {
    background: linear-gradient(135deg, #03759f, #4ECDC4);
    color: white;
    padding: 15px;
    text-align: center;
}

.game-header h1 {
    font-size: 1.5rem;
    margin-bottom: 5px;
    font-weight: 600;
}

.phase-indicator {
    font-size: 0.9rem;
    opacity: 0.9;
}

.game-info {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats {
    display: flex;
    gap: 15px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    font-size: 0.9rem;
}

.stat-emoji {
    font-size: 1.2rem;
}

.nest-info {
    font-size: 0.9rem;
    font-weight: 500;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 2px;
    padding: 15px;
    background: #f0f8ff;
    flex: 1;
    min-height: 200px;
    max-height: 300px;
}

.grid-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    border-radius: 8px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 40px;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.grid-cell:active {
    transform: scale(0.95);
}

.grid-cell.arrow {
    background: rgba(135, 206, 235, 0.3);
}

.grid-cell.arrow:hover {
    background: rgba(135, 206, 235, 0.5);
}

.grid-cell.fish {
    background: rgba(144, 238, 144, 0.3);
}

.grid-cell.fish:hover {
    background: rgba(144, 238, 144, 0.5);
}

.grid-cell.seabird {
    background: rgba(255, 215, 0, 0.4);
    border-color: #FFD700;
    animation: pulse 2s infinite;
}

.grid-cell.boat {
    background: rgba(139, 69, 19, 0.3);
}

.grid-cell.nest {
    background: rgba(222, 184, 135, 0.4);
    border-color: #DEB887;
}

.grid-cell.path-highlight {
    background: rgba(255, 255, 0, 0.6) !important;
    border-color: #FFD700;
}

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

.game-controls {
    padding: 15px;
    background: rgba(255, 255, 255, 0.9);
}

.instructions {
    text-align: center;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
}

.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 300px;
    width: 90%;
}

.overlay-content h2 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.5rem;
}

.overlay-content p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.4;
}

.overlay-reflection {
    text-align: left;
    background: rgba(3, 117, 159, 0.05);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.overlay-reflection h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: #03759f;
}

.overlay-reflection ul {
    list-style: disc;
    padding-left: 18px;
    color: #345;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

#restart-button {
    background: linear-gradient(135deg,  #6bffba, #4ECDC4);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#restart-button:hover {
    transform: scale(1.05);
}

#restart-button:active {
    transform: scale(0.95);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-dialog {
    position: relative;
    background: white;
    border-radius: 18px;
    padding: 28px;
    max-width: 360px;
    width: 90%;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 1;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: #999;
    cursor: pointer;
}

.modal-close:hover {
    color: #333;
}

.modal-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-left: 18px;
    color: #2C3E50;
    font-size: 0.95rem;
    line-height: 1.4;
}

.modal-tip {
    font-size: 0.85rem;
    color: #5D6D7E;
}

/* Mobile optimization */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    
    .game-container {
        border-radius: 10px;
    }
    
    .game-header h1 {
        font-size: 1.3rem;
    }
    
    .game-grid {
        padding: 10px;
        gap: 1px;
    }
    
    .grid-cell {
        font-size: 1.3rem;
        min-height: 35px;
    }
    
    .game-controls {
        padding: 10px;
    }
    
    .instructions {
        font-size: 0.8rem;
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    .game-container {
        max-height: 95vh;
    }
    
    .game-grid {
        min-height: 150px;
        max-height: 200px;
    }
    
    .grid-cell {
        min-height: 30px;
    }
}

/* Animation for seabird movement */
.seabird-moving {
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
}

/* Feedback animations */
.success-flash {
    animation: successFlash 0.5s ease;
}

@keyframes successFlash {
    0%, 100% { background-color: inherit; }
    50% { background-color: rgba(144, 238, 144, 0.8); }
}

.error-shake {
    animation: errorShake 0.5s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}